The documentation (
Data Binding in Blazor MultiSelect Dropdown component - Syncfusion) doesn't show how to use an ENUM as a bind-Value and I am not able to figure out how to accomplish that.
I modified the default Blazor WASM client-server template as follows:
1. Add a property to the WeatherForecast.cs
public IEnumerable DaysOfWeek { get; set; }
2. Add the enum values to the code behind class FetchData.razor.cs
public string[] EnumValues = Enum.GetNames(typeof(System.DayOfWeek));
public List GridData { get; set; }
3. Added a Multiselect Dropdown to the page FetchData.razor
var wf = (context as WeatherForecast);
SfMultiSelect @bind-Value="@(wf.DaysOfWeek)" DataSource="@EnumValues" Mode="@VisualMode.Box" Placeholder="Select Day of Week"
Full FetchData.razor:
https://gist.github.com/DanielEggers/b98c55929928847bf7e0edeffcfddc2d
I am able to select multiple days but afterwards (on Save) the DaysOfWeek property of the modified object is null.
PS: Why is it not possible to paste code snippets in here or attach code files?