locked
Shortcuts in WPF RRS feed

  • Question

  • Hello,

    I am trying to implement shortcuts for the buttons that I have in my application, and I would like, for instance, when pressing leftCtrl+O to open the window for loading a new object in the application, as it happens when you press the button to load.

    This is my code so far:

     

    private void shortcuts(object sender, KeyboardEventArgs e)
    {
         if (e.KeyboardDevice.IsKeyDown(Key.O))
         {
              if (MainControl.fileCtr.OpenFile())
             {
                 LoadContent();
              }
         }
    }
    

     

    And in the xaml file, i have: 

    <Button KeyDown="shortcuts" ... >

    But I get no response when pressing LeftCtrl+O.

    Can you help me with soem suggestions?

    Thank you

    Tuesday, May 3, 2011 12:17 PM

Answers

All replies