<Style x:Key="BlockContainerStyle" TargetType="{x:Type ContentControl}" > .... <Setter Property="ContextMenu"> <Setter.Value> <ContextMenu ItemsSource="{Binding Path=MenuItems}" ItemContainerStyle="{StaticResource ContextMenuItemStyle}"/> </Setter.Value> </Setter> </Style>
<Style x:Key="ContextMenuItemStyle"> <Setter Property="MenuItem.Header" Value="{Binding DisplayText}"/> <Setter Property="MenuItem.ItemsSource" Value="{Binding ChildItems}"/> <Setter Property="MenuItem.Command" Value="{Binding Command}" /> <Setter Property="MenuItem.CommandParameter" Value="{Binding}"></Setter> </Style>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)