When binding a property to the 'SelectedItem' of a WPF Combobox, I would expect to see that property setter get called every time the combobox's selection is changed. I'm not seeing that. Should the Combobox be calling the bound 'SelectedItem's property setter when the selection is changed?
Addition: I actually have the binding partially there: the property getter gets called and the property setter gets called once when the combobox is first loaded/selected and never called again upon later selection changes.
One thing I noticed is that when I put the IsSynchronizedWithCurrentItem="True" in the combobox entry in Xaml, the setter gets called once upon combobox loading/initial selection, but never again. When I remove that combobox attribute, the setter never gets called. Very strange.
Also, i'm referring to a view model property, not a dependency property. At least I didn't set it up as a dependency property. I'm new to this (Surprise!), so any more nuggets of info regarding this subject would be most appreciated.
xaml Code:
<ComboBox MinWidth="300" Margin="5,0,0,5"
ItemsSource="{Binding KeywordCollectionTypes, Mode=OneWay}"
SelectedItem="{Binding KeywordCollectionType, Mode=TwoWay}"
IsSynchronizedWithCurrentItem="True"/>
ViewModel Code (The Binded Attributes):
public Collection<string> KeywordCollectionTypes
{
get
{
return _KeywordCollectionTypes;
}
}
public string KeywordCollectionType
{
get
{
return _KeywordCollectionType;
}
set
{
_KeywordCollectionType = value;
OnPropertyChanged("KeywordCollectionType");
}
}
One more bit of info is that the combobox is within a DataGrid.RowDetailsTemplate, so could this strange update behavior be related to it being within a row details?