Files
radzen-blazor/RadzenBlazorDemos/Pages/DropDownMultipleMaxLabels.razor
2024-07-26 08:50:50 +03:00

22 lines
972 B
Plaintext

@using RadzenBlazorDemos.Models.Northwind
@inherits DbContextPage
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" JustifyContent="JustifyContent.Center" Gap="0.5rem" class="rz-p-sm-12">
<RadzenLabel Text="Select Values" Component="DropDownMultipleMaxLabels" />
<RadzenDropDown @bind-Value=@values Data=@products TextProperty="@nameof(Product.ProductName)" ValueProperty="@nameof(Product.ProductID)" Name="DropDownMultipleMaxLabels"
Multiple=true AllowClear=true Placeholder="Select products"
MaxSelectedLabels="2" SelectAllText="Select all items" SelectedItemsText="are now selected" Style="width: 100%; max-width: 400px;" />
</RadzenStack>
@code {
IEnumerable<int> values = new int[] { 1, 2 };
IEnumerable<Product> products;
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
products = dbContext.Products;
}
}