I have a ListBox WPF in Extended SelectionMode.
I need to bind a ListBox to an observable collection of a data element class, which is easy, but essentially, bind the IsSelected status of each ListBoxItem to a Boolean property in the corresponding data element.
And I need it to be two-sided so that I can populate the ListBox with selected and unselected items from the ViewModel.
I reviewed a number of implementations, but no one works for me. These include:
- Adding a DataTrigger to the ListBoxItem Style and Invoking a Change in State Action
I understand that this can be done in code with an event handler, but given the complexity of the domain, this would be terribly messy. I would rather stick with two-way snapping with ViewModel.
Thanks. Mark
source share