Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Landscape and portrait

$
0
0

Hi friends.
I would like to know when a page pass from Landscape to Portrait.
It seems that XF does not have an event for this.
Googling, I have found something like this

    protected override void OnSizeAllocated (double width, double height)
    {
        base.OnSizeAllocated (width, height);

        if (width != _width || height != _height)
        {
            _width = width;
            _height = height;
            if (width > height) // Landscape
                App.Globali.IsLandscape = true;
            else
                App.Globali.IsLandscape = false;
        }
    }

If I have a MasterDetail and put this code in "Detail" Page, this works fine.
But if I insert this code in "Master" page, width and height values does not change.

How can I solve this problem?
Thanks friends.


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>