Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

RE: Function key to call a menu option

$
0
0

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.


Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>