Posted 5 March 2018, 12:38 am EST
Hello,
I would like to attach a RightClick Event to the group row to open a context menu.
How can I achieve that? Thanks
Forums Home / ComponentOne / WPF Edition
Posted by: abellisomi on 5 March 2018, 12:38 am EST
Posted 5 March 2018, 12:38 am EST
Hello,
I would like to attach a RightClick Event to the group row to open a context menu.
How can I achieve that? Thanks
Posted 6 March 2018, 8:09 am EST
Hi,
By creating a custom cell factory and implementing its CreateOutlineCellContent method, you can access the panel using bdr.Child and then use its MouseDown event as follows to handle its right mouse button click:
private void Bdr_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Right)
{
// code for context menu
}
}
Thanks,
Ruchir Agarwal
Posted 9 March 2018, 3:00 am EST
For the purpose of my application this worked great:
<c1:C1DataGrid.GroupRowStyle>
<Style TargetType="c1:DataGridGroupRowPresenter">
<Setter Property="ContextMenu" Value="{StaticResource ContextMenuStyle}" />
</Style>
</c1:C1DataGrid.GroupRowStyle>