locked
I want to implement shortcuts on my Xamarin.Forms app in UWP. fill a form with Ctrl+S. RRS feed

  • Question

  • User378073 posted

    I want to implement shortcuts on my Xamarin.Forms app in UWP. I am filling a form and upon completion instead of clicking the save button , I want to save the form by pressing Ctrl+S. How to add that in UWP.

    Wednesday, September 30, 2020 10:02 AM

All replies

  • User89714 posted

    @stXamDev said: I want to implement shortcuts on my Xamarin.Forms app in UWP. I am filling a form and upon completion instead of clicking the save button , I want to save the form by pressing Ctrl+S. How to add that in UWP.

    You'll need a custom PageRenderer that handles KeyUp (or KeyDown depending on your preference). When it detects that Ctrl+S has been pressed, the renderer will need to notify the appropriate page in your View layer that Ctrl+S has been pressed (I suggest having pages that require Ctrl+S handling implement an interface, and have the renderer call through that interface). The page in the View layer will then call the appropriate Save command in your ViewModel (assuming that you are using MVVM).

    Wednesday, September 30, 2020 2:54 PM