I would highly recommend that for questions like this, how to use a .NET class or WPF functionality that you Google your question to other sources than this forum. The reason is that .NET is a Microsoft technology and there are many examples of how to use the various classes on other web sites and within the MSDN documentation.
For example, the link here explains how to handle a Menu control in WPF and provides examples in C#. These examples normally translate directly into COBOL but if you require help with the translation you can post your questions here.
I have researched a lot by Google but still could not find the solution and so resorted here to the forum.
I have also researched the link you sent me but I found the solution.
I will continue to look to see if I have better luck.
Ferraz, I created a quick sample in WinForms and by simply specifying the short-cut keys in the Collection they were enabled. There was no special code necessary to enable them. I first tried the sample with a mouse click and then I pressed "Ctrl 1" which was the short-cut and it worked.
How did you specify your short-cut keys?
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: