How to open Signature pad in landscape mode.

BhautikBhautik Member ✭✭✭

Hello,
I have implemented Signature Pad in my App and it is working fine. On some button click, I want Signature pad in landscape mode and on some other click event, it will back to the normal screen. So is there any way to do that?

Best Answers

Answers

  • BhautikBhautik Member ✭✭✭

    @Szbesta said:
    You can do that using the MessagingCenter.
    In Android I achieved this by doing the following:
    In your MainActivity.cs:

     MessagingCenter.Subscribe<YourSignaturePad>(this, "AllowLandscape", sender =>
                {
                    RequestedOrientation = ScreenOrientation.Landscape;
                });
                //forces app to portrait mode after closing a Page containing only a Plot
                MessagingCenter.Subscribe<YourSignaturePad>(this, "PreventLandscape", sender =>
                {
                    RequestedOrientation = ScreenOrientation.Portrait;
                });
    

    In your SignaturePad:

    MessagingCenter.Send(this,"AllowLandscape");
    MessagingCenter.Send(this, "PreventLandscape");
    

    What is MessagingCenter?
    And where I have to write this code?

  • BhautikBhautik Member ✭✭✭

    ``> @Szbesta said:

    You can do that using the MessagingCenter.
    In Android I achieved this by doing the following:
    In your MainActivity.cs:

     MessagingCenter.Subscribe<YourSignaturePad>(this, "AllowLandscape", sender =>
                {
                    RequestedOrientation = ScreenOrientation.Landscape;
                });
                //forces app to portrait mode after closing a Page containing only a Plot
                MessagingCenter.Subscribe<YourSignaturePad>(this, "PreventLandscape", sender =>
                {
                    RequestedOrientation = ScreenOrientation.Portrait;
                });
    

    In your SignaturePad:

    MessagingCenter.Send(this,"AllowLandscape");
    MessagingCenter.Send(this, "PreventLandscape");
    

    Thanks, It is working fine.Do you have any Idea about iOS?

  • BhautikBhautik Member ✭✭✭
    edited August 2018

    @ ColeX @Szbesta
    After implementing the above code everything is working fine. But by default screen rotation is not working.

Sign In or Register to comment.