DropDown with dictionaries

Hello @Team.

I've been changing most of the collections in my app to dictionaries to improve search times, because of binary search. However, it seems that the DropDown does not work well with this type of data. Here's the error, thrown on page load, and an implementation example:

image

<RadzenDropDown @bind-Value=@(SelectedControllerTypes) Data=@(ControllerTypes) Multiple="true" TextProperty="Value" ValueProperty="Key" />
...
private Dictionary<int, string> ControllerTypes = new Dictionary<int, string> { { (int)ControllerType.NEST600, "NEST600" } };
private int[] SelectedControllerTypes;

We will check if we can provide support for this

1 Like

Thanks for your efforts! As of 3.8.1, the DropDown component supports dictionaries.

Unfortunately I can't unselect/select items, as these errors are thrown:
image
image

Have you tried yourself my example in the OP?

Try to use IEnumerable<int> instead int[]

1 Like