Hello fellow Radzen users/fans!
I can't seem to get the @bind-SelectedItem of the RadzenListBox to work when Multiple="true". My RadzenListBox is as follows:
<RadzenListBox Style="height:700px;width:100%;"
Data="@contacts" TextProperty="DisplayName"
TValue="IEnumerable<ContactDto>" @bind-Value="selectedContacts" Change="@(args => Change(args))"
AllowFiltering="true" AllowClear="true" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
Multiple="true" @bind-SelectedItem="selectedContact">
</RadzenListBox>
The multiple selection is working just fine. I can get the list of the selected items.
But I'm also trying to bind the selected item (to 'selectedContact') to display other properties of the selected item elsewhere. The 'selectedContact' is currently an object type because I believe the RadzenListBox is expecting an object, but ideally, I would like it to be of ContactDto type. When I tried to cast, I get exception.
I also tried the below but it doesn't seem to get the last selected item in the list (which would give me the recently selected item):
var selectedContactsList = selectedContacts.ToList();
StateHasChanged();
contact = selectedContactsList.LastOrDefault();
Also, is there a way to check/uncheck the checkbox only by directly clicking on the checkbox of the item instead of merely by the act of selecting the item? This is a bit annoying and I do not know how to work around this.
Thank you ahead for the help.