Search code examples
c#windows-10win-universal-apphotkeys

Windows universal app and hot keys


I create windows universal app. I want to add shortcuts to AppBarButton. Is it possible? I did not find anything about it on the network.


Solution

  • I solved this question. This article and this article help me. If there is no control input can be used this code:

    // Listen to the window directly so focus isn't required
    Window.Current.CoreWindow.Dispatcher.AcceleratorKeyActivated +=
           CoreDispatcher_AcceleratorKeyActivated;
    
    Window.Current.CoreWindow.PointerPressed += this.CoreWindow_PointerPressed;
    

    This is example used AcceleratorKeyActivated .