diff --git a/src/BlazorVirtualScrolling.App/App.razor b/src/BlazorVirtualScrolling.App/App.razor
index 80fb778..0959dfe 100644
--- a/src/BlazorVirtualScrolling.App/App.razor
+++ b/src/BlazorVirtualScrolling.App/App.razor
@@ -1 +1,10 @@
-
+
+
+
+
+
+
+ Sorry, there's nothing at this address.
+
+
+
diff --git a/src/BlazorVirtualScrolling.App/BlazorVirtualScrolling.App.csproj b/src/BlazorVirtualScrolling.App/BlazorVirtualScrolling.App.csproj
index 992c703..e051b70 100644
--- a/src/BlazorVirtualScrolling.App/BlazorVirtualScrolling.App.csproj
+++ b/src/BlazorVirtualScrolling.App/BlazorVirtualScrolling.App.csproj
@@ -11,9 +11,9 @@
-
-
-
+
+
+
diff --git a/src/BlazorVirtualScrolling.App/Pages/Index.razor b/src/BlazorVirtualScrolling.App/Pages/Index.razor
index 4ea575d..15da0ae 100644
--- a/src/BlazorVirtualScrolling.App/Pages/Index.razor
+++ b/src/BlazorVirtualScrolling.App/Pages/Index.razor
@@ -4,16 +4,16 @@
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.
-VirtualScroll with @items.Count() items
+VirtualScroll with @Items.Count() items
-
+
@context
@functions
{
- public IEnumerable items = Enumerable.Range(0, 333000).Select(i => i.ToString()).ToArray();
+ public IEnumerable Items = Enumerable.Range(0, 333000).Select(i => i.ToString()).ToArray();
}
diff --git a/src/BlazorVirtualScrolling.App/Shared/MainLayout.razor b/src/BlazorVirtualScrolling.App/Shared/MainLayout.razor
index e3fcde7..056fc98 100644
--- a/src/BlazorVirtualScrolling.App/Shared/MainLayout.razor
+++ b/src/BlazorVirtualScrolling.App/Shared/MainLayout.razor
@@ -1,10 +1,9 @@
@using Microsoft.AspNetCore.Components
@inherits LayoutComponentBase
-@inject IUriHelper Url
- BlazorVirtualScrolling
+ BlazorVirtualScrolling
@@ -12,7 +11,7 @@
diff --git a/src/BlazorVirtualScrolling.App/_Imports.razor b/src/BlazorVirtualScrolling.App/_Imports.razor
index 9b3623e..e5c9d27 100644
--- a/src/BlazorVirtualScrolling.App/_Imports.razor
+++ b/src/BlazorVirtualScrolling.App/_Imports.razor
@@ -1,6 +1,6 @@
@using System.Net.Http
@using Microsoft.AspNetCore.Components.Forms
-@using Microsoft.AspNetCore.Components.Layouts
+@using Microsoft.AspNetCore.Components
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.JSInterop
@using BlazorVirtualScrolling.App
diff --git a/src/BlazorVirtualScrolling/BlazorVirtualScrolling.csproj b/src/BlazorVirtualScrolling/BlazorVirtualScrolling.csproj
index e478f18..ffe8266 100644
--- a/src/BlazorVirtualScrolling/BlazorVirtualScrolling.csproj
+++ b/src/BlazorVirtualScrolling/BlazorVirtualScrolling.csproj
@@ -1,4 +1,4 @@
-
+
netstandard2.0
@@ -32,7 +32,9 @@
-
+
+
+
diff --git a/src/BlazorVirtualScrolling/Components/VirtualScroll/BaseVirtualScroll.cs b/src/BlazorVirtualScrolling/Components/VirtualScroll/BaseVirtualScroll.cs
index 2a3b5d9..19daea6 100644
--- a/src/BlazorVirtualScrolling/Components/VirtualScroll/BaseVirtualScroll.cs
+++ b/src/BlazorVirtualScrolling/Components/VirtualScroll/BaseVirtualScroll.cs
@@ -19,7 +19,7 @@ public class BaseVirtualScroll : ComponentBase, IVirtualScroll
[Parameter]
public int ItemHeight { get; set; } = 50;
- public ElementRef Ref { get; set; }
+ public ElementReference Ref { get; set; }
[Parameter]
public RenderFragment ChildContent { get; set; }
@@ -29,21 +29,18 @@ public class BaseVirtualScroll : ComponentBase, IVirtualScroll
[Inject]
public IJSRuntime JsRuntime { get; set; }
-
- private bool isFirstRender = true;
-
- protected override async Task OnAfterRenderAsync()
+
+ protected override async Task OnAfterRenderAsync(bool firstRender)
{
- await base.OnAfterRenderAsync();
- if (isFirstRender)
+ await base.OnAfterRenderAsync(firstRender);
+ if (firstRender)
{
this.JsHelper = new VirtualScrollJsHelper(this);
- var scrollView = await JsRuntime.InvokeAsync("blazorVirtualScrolling.init", Ref, new DotNetObjectRef(JsHelper));
- this.SetScrollView(scrollView);
- isFirstRender = false;
+ var scrollView = await JsRuntime.InvokeAsync("blazorVirtualScrolling.init", Ref, DotNetObjectReference.Create(JsHelper));
+ this.SetScrollView(scrollView);
}
}
-
+
public VirtualScrollJsHelper JsHelper { get; set; }
public void VirtualScrollingSetView(ScrollView scrollView)
diff --git a/src/BlazorVirtualScrolling/VirtualScroll.razor b/src/BlazorVirtualScrolling/VirtualScroll.razor
index 430b0cf..cc86e04 100644
--- a/src/BlazorVirtualScrolling/VirtualScroll.razor
+++ b/src/BlazorVirtualScrolling/VirtualScroll.razor
@@ -5,7 +5,7 @@
@using Microsoft.AspNetCore.Components
@inherits BaseVirtualScroll
-