Function key to call a menu option

Hello, 

How do I place a function key to call a menu option?
And how does the show in menu?
Thanks
Alberto Ferraz
Parents
  • I have done some research on this and have found in the link that I provided to you a section on using Commands in WPF and binding them to controls like menu items and buttons, etc.

    In particular the one that I found useful was to define all of your command as type RoutedUICommand within a static class and then bind your menu items to these commands within XAML.

    By attaching the CanExecute and Executed events to each command you can have it automatically invoke a specified method whenever the command is executed. Commands can be executed by selecting the control such as a menu item or by pressing a key which you have defined as an InputGesture for the command.

    There was some syntax in the C# example for RoutedUICommands that involved initializing a collection directly within the constructor of the field that was not directly supported in the current version of Visual COBOL so I devised a workaround of creating a property for each of the commands.

    I have attached an example to this post. The example defines the commands used in a static class and then references them both as menu items and as buttons. You could also use the same commands in a context menu.

    Let me know if you have any questions:

    Thanks.

    WPFFunctionKeys.zip
Reply
  • I have done some research on this and have found in the link that I provided to you a section on using Commands in WPF and binding them to controls like menu items and buttons, etc.

    In particular the one that I found useful was to define all of your command as type RoutedUICommand within a static class and then bind your menu items to these commands within XAML.

    By attaching the CanExecute and Executed events to each command you can have it automatically invoke a specified method whenever the command is executed. Commands can be executed by selecting the control such as a menu item or by pressing a key which you have defined as an InputGesture for the command.

    There was some syntax in the C# example for RoutedUICommands that involved initializing a collection directly within the constructor of the field that was not directly supported in the current version of Visual COBOL so I devised a workaround of creating a property for each of the commands.

    I have attached an example to this post. The example defines the commands used in a static class and then references them both as menu items and as buttons. You could also use the same commands in a context menu.

    Let me know if you have any questions:

    Thanks.

    WPFFunctionKeys.zip
Children
No Data