I have a WPF ComboBox which is databound to a Collection, but depending on wether a Checkbox is checked or not I’d like to vary which Collection the ComboBox is bound to.
The basic issue is I have a large collection of MyCustomer and I also have a filtered collection of MyCustomer – the filtering is quite intensive and I don’t want to do it with a CollectionView for the main reason that it is already done, the filtered collection already exists – hence the need to simply switch the databinding of the combo.
I’m hoping for a pure XAML solution, obviously writing some code behind would be a relatively simple solutions but it doesn’t feel like it should be required.
Here’s an example using a DataTrigger to switch the collections:
For you these wouldn’t be different arrays, but probably different CollectionViewSources with filters or something, but the principle is the same.