c# - WPF menus with shortcuts and custom RoutedCommand -


I'm new to WPF, so I'm missing out on something. In my main window is a simple function called StartService I wanted to add "Start Service" a menu item with the shortcut Ctrl + S in your application I do the following:

  1. in my main window class I had to define it:

    public static routing Command StartServiceRoutedCmd = new routing Command ();

  2. ; Menu Header = "_Start service" InputStore text = "Ctrl + S" Click = "Onstart service" /> & Lt; Window.CommandBinding & gt; & Lt; Kmmandbanding command = "{x: Static Public: Men Wando. Startsisrauted CMD}" Execute = "Onstart service" / & gt; & Lt; /Window.CommandBindings> & Lt; Window.InputBindings & gt; & Lt; Key bindings Command = "Public: Menwando. Startsisrauted CMD" gesture = "Ctrl + S" / & gt; & Lt; /Window.InputBindings>

    Things are working, I'm thinking that this is the right and organized way? I need a shortcut for my StopService function. Does this mean I need to define a new RoutedCommand StopServiceRoutedCmd for every shortcut I need, and so on?

   & Lt; / Window.InputBindings & gt;  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -