RadzenDropDown @bind-SelectedItem

For a RadzenDropDown I want to bind the full object that has been seleced.

<RadzenDropDown TValue="MyClass" @bind-SelectedItem="@myClass" Data="@listMyClasses" TextProperty="Name" ValueProperty="Id" />

In my code I defined myClass as an object of type MyClass:

public MyClass myClass { get; set; }

But at compile time I will get the error:

Cannot implicitly convert type 'object' to 'MyClass'. An explicit conversion exists (are you missing a cast?)

You can bind only property of type object to DataGrid Value since it can be single or multiple items

1 Like

I assumed the TValue would act as some kind of converter. But with the explanation that multiple items are possible too the general object makes sense. Thanks!

Obviously. But it doesn't have to be that way. The focus must be transferred to the dialogue.Default input or button. Some default element.