WPF ContextMenu with ItemsSource - how to bind to Command in each item? [duplicate] WPF ContextMenu with ItemsSource - how to bind to Command in each item? [duplicate] wpf wpf

WPF ContextMenu with ItemsSource - how to bind to Command in each item? [duplicate]


<ContextMenu.ItemContainerStyle>  <Style TargetType="MenuItem">    <Setter Property="Command" Value="{Binding AssociatedCommand}" />  </Style></ContextMenu.ItemContainerStyle>

where AssociatedCommand is the property on the viewmodel object that holds the ICommand.