diff --git a/src/Components/Web/src/Virtualization/Virtualize.cs b/src/Components/Web/src/Virtualization/Virtualize.cs index 40d5af6d29df..d1e233bd0026 100644 --- a/src/Components/Web/src/Virtualization/Virtualize.cs +++ b/src/Components/Web/src/Virtualization/Virtualize.cs @@ -55,7 +55,7 @@ public sealed class Virtualize : ComponentBase, IVirtualizeJsCallbacks, I private IJSRuntime JSRuntime { get; set; } = default!; /// - /// Gets or sets the item template for the list. + /// Gets or sets the child content for the list. /// [Parameter] public RenderFragment? ChildContent { get; set; } @@ -66,6 +66,12 @@ public sealed class Virtualize : ComponentBase, IVirtualizeJsCallbacks, I [Parameter] public RenderFragment? ItemContent { get; set; } + /// + /// Gets or sets the `` that is used when no items are available. + /// + [Parameter] + public RenderFragment? EmptyContent { get; set; } + /// /// Gets or sets the template for items that have not yet been loaded in memory. /// @@ -193,6 +199,11 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) builder.OpenRegion(3); + if (EmptyContent is not null && _itemCount == 0) + { + EmptyContent(builder); + } + // Render placeholders before the loaded items. for (; renderIndex < placeholdersBeforeCount; renderIndex++) {