Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
875
How to make keyboard shortcuts work in grid's context menu?
posted

I have my ContextMenu set up how i want it.  Where do i put the InputBindings and Keybindings xaml to function inside the XamDataPresenter control? 

 

Something like (for Cut:

<igDP:XamDataPresenter.InputBindings>
       
<KeyBinding Key="X"
                   
Modifiers="Ctrl"
                   
Command="{Binding Path=CutCommand}"/> //what do put here-this binding doesn't work
   
</
igDP:XamDataPresenter .InputBindings>

 

<igDP:XamDataPresenter.ContextMenu>
                    <ContextMenu x:Name="Menu">
                        <MenuItem Header="Cut" InputGestureText="Ctrl+X" Command="{Binding Path=CutCommand}"
                                  CommandParameter="{Binding Path=PlacementTarget, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ContextMenu}}}"/>
                        <MenuItem Header="Copy" InputGestureText="Ctrl+C" Command="{Binding Path=CopyCommand}"
                                  CommandParameter="{Binding Path=PlacementTarget, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ContextMenu}}}"/>
                        <MenuItem Header="Paste" InputGestureText="Ctrl+V" Command="{Binding Path=PasteCommand}"/>
                        <Separator/>
                        <MenuItem Header="Delete" InputGestureText="Delete" Command="{Binding Path=DeleteCommand}"
                                  CommandParameter="{Binding Path=PlacementTarget, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ContextMenu}}}"/>
                        <MenuItem Header="Print" InputGestureText="Ctrl+P" Command="{Binding Path=PrintCommand}"
                                  CommandParameter="{Binding Path=PlacementTarget, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ContextMenu}}}"/>
                    </ContextMenu>
                </igDP:XamDataPresenter.ContextMenu>

Parents Reply Children
No Data