The following code is not calling the SelectedItem's property setter in my view model.
<ComboBox x:Name="cmbGuaranteeType" Margin="5,5,5,5" MinWidth="80"
ItemsSource="{Binding Source={StaticResource guaranteeTypesKey}}"
SelectedItem="{Binding RelativeSource={RelativeSource AncestorType={x:Type wpfToolkit:DataGridRow}}, Path=DataContext.GuaranteeType, Mode=TwoWay}"
/>
The view is a UserControl bound to a ViewModel. The UserControl has a WpfToolkit datagrid which is bound to an ObservableCollection on the ViewModel. The ObservableCollection consists of a List<T>
items. The above combobox is binding to the "GuaranteeType" property on one of the T items as follows:
public GuaranteeType? GuaranteeType
{
get { return _guaranteeType; }
set { _guaranteeType = value; NotifyPropertyChanged(ConstGuaranteeType); }
}
When the UserControl is loaded, the GuaranteeType property's getter is called and the SelectedItem is set correctly. However, when I click on the ComboBox and attempted to change the SelectedItem, the setter for the GuarenteeType property is never called.
Additionally, I implemented the SelectionChanged="cmbGuaranteeType_SelectionChanged"
in XAML against the View's codebehind and when the view is loading the SelectionChanged method is called once but it is not called when I release the mouse when trying to change the selected item of the combobox.