0

I'm using XamDatagrid from Infragistics and I need to raise MouseRightButtonClick event programmatically(when user press the button).

I have following XAML markup:

        <igDP:XamDataGrid>
           <igDP:XamDataGrid.Resources>
                <igDP:XamDataGrid.Resources>
                <!-- Record Context Menu -->
                <ContextMenu x:Key="OrdersGridContextMenu">
                    <MenuItem Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type igDP:XamDataGrid}}, Path=DataContext.DoubleClickItemCommand}" 
                              Header="Open"
                              CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContextMenu}},Path=PlacementTarget}"/>
                </ContextMenu>
            </igDP:XamDataGrid.Resources>


        </igDP:XamDataGrid>

So, I need to show context menu (raise rightClick event on grid) programmatically. Maybe someone can provide any solution with XamDataGrid or simple DataGrid?

Alex44
  • 139
  • 2
  • 6
  • 1
    if you want to show the ContextMenu, consider the property `IsOpen`, I don't think raising the event is the straight way to go, it may not even help show the ContextMenu. – King King Nov 22 '14 at 17:36
  • I agree with @KingKing - also, you will quickly learn that the ContextMenu is not inserted into the visual tree of the control that spawned it, so your MenuItem bindings won't work as shown. more info here: http://stackoverflow.com/questions/3668654/relativesource-binding-from-a-tooltip-or-contextmenu – Andrew Nov 23 '14 at 01:30

0 Answers0