Welcome to the Blazor feedback portal. We’re happy you’re here! If you have feedback on how to improve the Blazor, we’d love to hear it!>
Thanks for joining our community and helping improve Syncfusion products!
Need to provide support for handling ICollection for bind-value property.
Please find the code and sample details below.
|
@using Syncfusion.Blazor.DropDowns @using Syncfusion.Blazor.Data @using System.Collections <SfMultiSelect TValue="ICollection<Complex1>" TItem="Complex1" Placeholder="e.g. Select a country" @bind-Value="@UsuarioView.Papeis" DataSource="@LocalData"> <MultiSelectFieldSettings Text="Country.CountryID" Value="Code.ID"></MultiSelectFieldSettings> </SfMultiSelect> @code { public IEnumerable<Complex1> LocalData { get; set; } = new Complex1().GetData(); public class Code { public string ID { get; set; } } public class Country { public string CountryID { get; set; } } public Complex1 UsuarioView = new Complex1(); public class Complex1 { public Country Country { get; set; } public Code Code { get; set; } public ICollection<Complex1> Papeis { get; set; } = new List<Complex1>() { new Complex1() { Country = new Country() { CountryID = "Australia" }, Code = new Code() { ID = "AU" } } }; public ICollection<Complex1> GetData() { ICollection<Complex1> Data = new List<Complex1>(); Data.Add(new Complex1() { Country = new Country() { CountryID = "Australia" }, Code = new Code() { ID = "AU" } }); Data.Add(new Complex1() { Country = new Country() { CountryID = "Bermuda" }, Code = new Code() { ID = "BM" } }); Data.Add(new Complex1() { Country = new Country() { CountryID = "Canada" }, Code = new Code() { ID = "CA" } }); Data.Add(new Complex1() { Country = new Country() { CountryID = "Cameroon" }, Code = new Code() { ID = "CM" } }); Data.Add(new Complex1() { Country = new Country() { CountryID = "Denmark" }, Code = new Code() { ID = "DK" } }); Data.Add(new Complex1() { Country = new Country() { CountryID = "France" }, Code = new Code() { ID = "FR" } }); return Data; } } } |
Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/bind_value_icollection-371820731