MultiSelect Dropdown needs to support specific enum
Hi,
Months ago I've reported that when the TValue is a list of specific enum, the component doesn't bind correctly (https://www.syncfusion.com/forums/195959/bind-value-not-working-when-tvalue-is-a-list-of-enum )
The workaround was to work with Enum instead. It seems to work but there are some issues :
- Using a List<Enum> will force me to sooner or later convert to List<MyEnum> when I want to work with the specific enum, so that's not convenient and can lead to several cast issues.
- There is at least one case where it's not working the same comparing to a List<string> : when conditioning the template (see the repro link below)
After thoroughly investigating the issue, identified that the root cause stems from a type mismatch between using a generic List<Enum> versus a strongly-typed List<MyEnum>. MultiSelect requires that the TValue and TItem parameters align precisely in their types to correctly bind and compare values. Using mismatched types can lead to unexpected behavior or binding failures.
Define a specific enum type (e.g., MyEnum) and use a strongly-typed class (e.g., EnumItem) for the data source to ensure type safety and proper behavior—especially with conditional rendering .
Your sample doesn't work either.
If you use @bind-Value="bindedList" instead of just Value="bindedList", you'll see that the binding is broken even though TValue and TItem are strongly typed.
Just select another value in the MultiSelect and you'll see that the bindedList will be empty, so it's even worse than using the Enum type.
See your updated sample : https://blazorplayground.syncfusion.com/LNLoZxXBTARFWddp
Hi Julien Barach ,
We have considered the reported issue "Preselected value binding not working on toggling display in SfMultiSelect with Enum KeyValuePair datasource" as a bug from our end. We are glad to inform you that the fix for this issue will be included in our upcoming patch release, which is scheduled for mid-July 2025.
Now you can track the status of the reported issue through the feedback below,
Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”
Regards ,
Mallesh R
We have included the fix for the issue “Preselected value binding not working on toggling display in SfMultiSelect with Enum KeyValuePair datasource ” with our package version “30.1.41 v”. Therefore, we recommend upgrading to our latest version to resolve the current issue.
Release Notes : https://blazor.syncfusion.com/documentation/release-notes/30.1.41?type=all#multiselect
Sample : https://blazorplayground.syncfusion.com/rjroXwVoTmwKmECN
Root Cause :
Earlier, when the request was made using the bound value, the correct data was not retrieved because the query value was transmitted as an enum value. This led to the occurrence of the reported issue.
- 4 Replies
- 2 Participants
-
JB Julien Barach
- May 13, 2025 04:10 PM UTC
- Jul 25, 2025 01:28 PM UTC