I have a ContextMenu defined in a control this way...
<Controls:MetroWindow.Resources> <ContextMenu x:Key="RowContextMenu"> <MenuItem Header="{Binding CurrentLang.CmenuItemUnLockUser}"/> </ContextMenu> CurrentLang.CmenuItemUnLockUser is a string.
The DataContext is defined in the xaml (and working...):
<Controls:MetroWindow.DataContext> <admin:AdminViewModel/> </Controls:MetroWindow.DataContext> The BlockedUserContextMenu is used in a DataGrid and defined as:
<DataGrid x:Name="DgridCases" ItemsSource="{Binding CasesCollection" ...> <DataGrid.RowStyle> <Style TargetType="{x:Type DataGridRow}"> <Setter Property="ContextMenu" Value="{StaticResource RowContextMenu}" /> </Style> </DataGrid.RowStyle> CasesCollection is an ObservableCollection of CaseObject objects, i can see in the output window that can't found CurrentLang.CmenuItemUnLockUser in the CaseObject, so, the issue is related to the datacontext...
How can i specify the right datacontext?
Thanks!
<ContextMenu DataContext={Binding}...?