Best way I know is to use some shell collection that internally 'gets' the right collection.
So you have your UnfilteredCollection and your FilteredCollection and then a property called BindingCollection which, in its 'getter,' evaluates some state (the checkbox would be bound to this state) to determine which collection to retrieve.
If you use MVVM for the databinding between the UI and the collections, one way to do it would be like this:
<!-- Your ComboBox binds to some shell collection -->
<ComboBox ItemsSource="{Binding BindingCollection}" />
<!-- The input to this item will determine which collection is internally exposed -->
<CheckBox IsChecked="{Binding UseFilteredSet}" />
And then have your ViewModel (middle-layer) file do something like this (I'm not including the implementation details of INotifyPropertyChanged, but I can if you wish):
private ObservableCollection<MyCustomer> UnfilteredCollection
{
get { return _unfilteredCollection; }
}
private ObservableCollection<MyCustomer> FilteredCollection
{
get { return _filteredCollection; }
}
// The public collection to which your ComboBox is bound
public ObservableCollection<MyCustomer> BindingCollection
{
get
{
return UseFilteredSet ?
FilteredCollection :
UnfilteredCollection;
}
}
// CheckBox is bound to this state value, which tells the bindings on the shell
// collection to refresh when the value of this state changes.
public bool UseFilteredSet
{
get { return _useFilteredSet; }
set
{
_useFilteredSet = value;
OnPropertyChanged("UseFilteredSet");
OnPropertyChanged("BindingCollection");
}
}