I have a ComboBox as follows:
- Itemssource property is bounded to an ObservableCollection with custom objects (e.g. items A, B, C).
- SelectedItem property is bounded to an object which does not exist in the ItemsSource’s bounded collection of objects (e.g. item D).
I intend to have it exhibit the following behavior:
- ComboBox automatically adds the SelectedItem property (in this case, item D) to the bounded ObservableCollection.
- ComboBox is shown to have item D selected.
Anybody has any idea on how this can be done using WPF’s ComboBox or other components? Any help would be greatly appreciated.
It would help if you provide some more information, but generally you will have to add your item D in the underlying data source first as you can’t have ItemsSource set and be adding additional items to the ComboBox (or any other item container for that matter).