SO I have a WPF MVVM application. When I press a button, I want a new entry to be added to the dropdown in a combobox, and for the combobox's selected item to be set to that item. I'm able to get the item added to the dropdown through an ObservableCollection, but I can't seem to bind the SelectedItem properly. I have tried:
<ComboBox ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" />
And putting the SelectedItem directly in the ViewModel implementing INotifyPropertyChanged in the ViewModel. But this does not work. Any ideas?
EDIT: I should also add that the OnNotifyPropertyChange event does fire correctly when I expect it to, so I'm not sure what's going on. I also tried using UpdateSourceTrigger=PropertyChanged
to no avail.