Hi,
I need separate context menu for the grid rows and the grid headers.
I defined the rows context menu in the xaml like this:
<telerikGrid:RadGridView x:Name="ordersGrid" AutoGenerateColumns="False" DataLoadMode="Synchronous" >
<Navigation:RadContextMenu.ContextMenu>
<Navigation:RadContextMenu Opened="RadContextMenu_Opened" ItemClick="RadContextMenu_ItemClick">
<Navigation:RadContextMenu.Items>
<Navigation:RadMenuItem Header="Update Order" />
<Navigation:RadMenuItem Header="Cancel Order" />
<Navigation:RadMenuItem Header="View Details" />
</Navigation:RadContextMenu.Items>
</Navigation:RadContextMenu>
</Navigation:RadContextMenu.ContextMenu>
and i defined in the code the context menu for the headers.
The problem is that the main context menu overrides the header context menu. I even try to remove it in the loaded event but it didn't help:
void ordersGrid_Loaded(object sender, RoutedEventArgs e)
{
GridViewHeaderRow headerRow = ordersGrid.ChildrenOfType<GridViewHeaderRow>().FirstOrDefault();
IEnumerable<GridViewHeaderCell> cells = headerRow.Cells.OfType<GridViewHeaderCell>();
/**remove the default menu from the header in order to ser a separate menu for header**/
foreach (GridViewHeaderCell cell in cells)
{
var x = cell.ContextMenu;
RadContextMenu.SetContextMenu(cell, null);
}
GridViewHeaderMenu gvhm = new GridViewHeaderMenu(ordersGrid);
gvhm.InitializeMenus();
}
How can i achieve it?
Thanks,
Ofer