The VirtualScroll
displays large lists of elements performantly by only rendering the items that fit on-screen. Loading hundreds of elements can be slow in any browser; virtual scrolling enables a performant way to simulate all items being rendered by making the height of the container element the same as the height of total number of elements to be rendered, and then only rendering the items in view.
Don't know what Blazor is? Read here
Complete all Blazor dependencies.
- .NET Core 3.0 Preview 4 SDK (3.0.0-preview4-19216-03)
- Visual Studio 2019 Preview 4 with the ASP.NET and web development workload selected.
- The latest Blazor extension from the Visual Studio Marketplace.
- The Blazor templates on the command-line: dotnet new -i Microsoft.AspNetCore.Blazor.Templates::3.0.0-preview4-19216-03
To Install
Install-Package BlazorVirtualScrolling
or
dotnet add package BlazorVirtualScrolling
@using BlazorVirtualScrolling
<VirtualScroll style="height: 500px;" ItemType="string" Items="@items" ItemHeight="50">
<div>@context</div>
</VirtualScroll>
@functions
{
public IEnumerable<string> items = Enumerable.Range(0, 1000000).Select(i => i.ToString()).ToArray();
}
- Startup.cs
app.UseEmbeddedBlazorContent(typeof(BlazorVirtualScrolling.VirtualScroll).Assembly);
- _Host.cshtml (head section)
@using EmbeddedBlazorContent
<head>
...
@Html.EmbeddedBlazorContent()
</head>
For how-to questions and other non-issues, for now you can use issues or you can use .
We'd greatly appreciate any contribution you make. :)
This project is licensed under the terms of the MIT license.
- First version of VirtualScroll component, proof of concept