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

How to change the MasterDetailPage.MasterBehavior depending on the width

$
0
0

Hello,

I write a Xamarin forms application for UWP and try to use an adaptive UI. On a small screen I want the MasterBehavior to be 'popover' and on a large screen it should be 'split'. I registered the SizeChanged event and change the MasterBehaviour but it does not work. What must I do to make it work?

public MainPage()
        {
            this.InitializeComponent();
            SizeChanged += OnSizeChanged;
        }

        private void OnSizeChanged(object sender, EventArgs e)
        {
            if ( Width < 700)
            {
                this.MasterBehavior = MasterBehavior.Popover;
                UpdateChildrenLayout();
            } else
            {
                this.MasterBehavior = MasterBehavior.Split;
                UpdateChildrenLayout();
            }
        }

Viewing all articles
Browse latest Browse all 77050

Trending Articles



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