I finaly did it)
Code:
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" JustifyContent="JustifyContent.Center" Gap="0.5rem" class="rz-p-12">
<RadzenLabel Text="Select Value" Component="DropDownDataGridTextValueProperties" />
<RadzenDropDownDataGrid @bind-Value=@customer Data=@customers TextProperty="@nameof(Customer.CompanyName)"
AllowVirtualization=true AllowFiltering=false PagerAlwaysVisible=false Name="DropDownDataGridTextValueProperties">
<Columns>
<RadzenDropDownDataGridColumn Property="CustomerID" Title="Customer ID" Width="60px" TextAlign="TextAlign.Center" />
<RadzenDropDownDataGridColumn Property="CompanyName" Title="Company Name" Width="150px" />
</Columns>
</RadzenDropDownDataGrid>
<RadzenButton Variant="Variant.Text" Click=@Refresh Icon="refresh" Size="ButtonSize.Small" />
</RadzenStack>
@code {
Customer customer;
List<Customer> customers = new();
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
}
private void Refresh()
{
customers = new List<Customer>()
{
new Customer() { CustomerID = 1, CompanyName = "CompanyName1" },
new Customer() { CustomerID = 2, CompanyName = "CompanyName2" },
new Customer() { CustomerID = 3, CompanyName = "CompanyName3" }
};
customer = customers.First();
}
class Customer
{
public int CustomerID { get; set; }
public string CompanyName { get; set; }
}
}
Exception:
main point of this exception is
List<Customer> customers = new();
and
AllowVirtualization=true