How to set RightClick event on Group row

Posted by: abellisomi on 5 March 2018, 12:38 am EST

    • Post Options:
    • Link

    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>
    
    
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels