i am trying to bind the context menu (with checkbox) of tab to observable collection. When user checks or uncheks the menuitem for the first time, that state is reflected in associated bool variable in obesarvable collection. But after that it not reflected. Binding in XAML looks like this :
<TabItem.ContextMenu>
<ContextMenu Name="menu"
ItemsSource="{Binding Path=FieldNameCollection,Mode=TwoWay}"
ItemTemplate="{StaticResource SelectIndexFieldMenu}"></ContextMenu>
</TabItem.ContextMenu>
Data Template is
<DataTemplate x:Key="SelectIndexFieldMenu">
<MenuItem Header="{Binding Path=IndexFieldName}"
IsCheckable="True"
IsChecked="{Binding Path=isIndexFieldSelected,Mode=TwoWay}"
IsEnabled="{Binding Path=isCheckBoxEnabled}" />
</DataTemplate>
(i am not able to add code snippet, so i removed '<' :( ) The class for observable collection is derived from NotifierBase. Another thing i noticed is if I check the context menu's itemsource in view.xaml.cs at ContextMenuClosing, the states are correctly reflected.
INotifyPropertyChanged
interface in your class? – decyclone