Skip to content

Commit aed195f

Browse files
authored
Add amendable OverscanCount parameter to the QuickGrid for virtualization. (#55078)
1 parent 22bf0d0 commit aed195f

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
#nullable enable
2+
Microsoft.AspNetCore.Components.QuickGrid.QuickGrid<TGridItem>.OverscanCount.get -> int
3+
Microsoft.AspNetCore.Components.QuickGrid.QuickGrid<TGridItem>.OverscanCount.set -> void

src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<Virtualize @ref="@_virtualizeComponent"
2323
TItem="(int RowIndex, TGridItem Data)"
2424
ItemSize="@ItemSize"
25+
OverscanCount="@OverscanCount"
2526
ItemsProvider="@ProvideVirtualizedItems"
2627
ItemContent="@(item => builder => RenderRow(builder, item.RowIndex, item.Data))"
2728
Placeholder="@(placeholderContext => builder => RenderPlaceholderRow(builder, placeholderContext))" />

src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ public partial class QuickGrid<TGridItem> : IAsyncDisposable
6363
/// </summary>
6464
[Parameter] public bool Virtualize { get; set; }
6565

66+
/// <summary>
67+
/// This is applicable only when using <see cref="Virtualize"/>. It defines how many additional items will be rendered
68+
/// before and after the visible region to reduce rendering frequency during scrolling. While higher values can improve
69+
/// scroll smoothness by rendering more items off-screen, they can also increase initial load times. Finding a balance
70+
/// based on your data set size and user experience requirements is recommended. The default value is 3.
71+
/// </summary>
72+
[Parameter] public int OverscanCount { get; set; } = 3;
73+
6674
/// <summary>
6775
/// This is applicable only when using <see cref="Virtualize"/>. It defines an expected height in pixels for
6876
/// each row, allowing the virtualization mechanism to fetch the correct number of items to match the display

0 commit comments

Comments
 (0)