When I have a component that inherits RadzenDropDown and sets LoadData inside that component for some reason TextProperty doesn't work.
Minimal example:
Index.razor
<TestDropDown TValue="Guid" TextProperty="Name" ValueProperty="Id" LoadDataHandler="Test" />
@code {
record Employee(Guid Id, string Name);
private async Task<IEnumerable> Test()
{
IEnumerable<Employee> emps = [new(Guid.NewGuid(), "123"), new(Guid.NewGuid(), "321")];
return emps;
}
}
TestDropDown.cs
public class TestDropDown<TValue> : RadzenDropDown<TValue>
{
[Parameter] public Func<Task<IEnumerable>> LoadDataHandler { get; set; } = default!;
protected override void OnParametersSet()
{
LoadData = new(this, async () => Data = await LoadDataHandler());
base.OnParametersSet();
}
Result:
When I do the same (Data = ...) but outside of TestDropDown everything works fine.