How to use ContextMenu for RowHeader

Apr 20, 2009 at 11:20 AM
Edited Apr 20, 2009 at 11:22 AM
Hi

There's one ContextMenu of My ControlRowHeader style, but now I need move the style to ResourceDictionary, since becasue context menu has events, so it cannot used from dictionary directly. Anybody has a solution to help me use ContextMenu just for RowHeader.

Thanks very much

<Style x:Key="ControlRowHeaders" TargetType="{x:Type dg:DataGridRowHeader}">

 

<Setter Property="ContextMenu" Value="{StaticResource RowHeaderContextMenu}"/>
... ...
</Style>

 

 

 

<ContextMenu x:Key="RowHeaderContextMenu" >

 

 

 

<MenuItem Header="Move Up"/>

 

 

 

<MenuItem Header="Move Down"/>

 

 

 

<Separator/>

 

 

 

<MenuItem Header="Remove File"/>

 

 

 

<MenuItem Header="Remove from Group" IsEnabled="{Binding Path=IsFileInGroup}"/>

 

 

 

<!--<MenuItem Header="Move Up" Click="MoveUp_MenuItem_Click"/>

 

 

 <MenuItem Header="Move Down" Click="MoveDown_MenuItem_Click"/>

<Separator/>

<MenuItem x:Name="Reomve_File_MenuItem" Header="Remove File" Click="btnRemoveFile_Click"/>

<MenuItem x:Name="Reomve_from_Group_MenuItem" Header="Remove from Group" Click="btnRemoveFromGroup_Click" IsEnabled="{Binding Path=IsFileInGroup}"/>-->

 

 

 

</ContextMenu>