Forum General

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

stXamDevstXamDev Member ✭✭✭
edited September 2020 in General

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.

Posts

  • JohnHardmanJohnHardman GBUniversity admin

    @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).

Sign In or Register to comment.