Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Change MasterBehavior for UWP

$
0
0

Hi, I work with a Master-Detail page. On IOS and Android the split or PopOver mode is changed automatically with the space available on the device but not in UWP :( !
So I create a derived MasterDetailPage hijacking the OnSizeAllocated event and check the size available in a "bootstrap way". Now in my SetLayout of the MasterDetailPage I do that:

    private void SetLayout(BreakPoint layoutBreakPoint)
    {
        switch(Device.RuntimePlatform)
        {
            case Device.UWP:
                if (layoutBreakPoint >= BreakPoint.Small)
                {
                    MasterBehavior = MasterBehavior.Split;
                    _modeSplit = true;
                }
                else
                {
                    MasterBehavior = MasterBehavior.Popover;
                    IsPresented = false;
                    _modeSplit = false;
                }
                break;
        }
    }

When UWP app start, I receive a SetLayout with a XSmall break (I think the starting app does not take all the space at startup), then another SetLayout with Large Breakpoint. So, my code set the MasterBehavior to PopOver then Split very fast. The second call that set it to SPLIT is ignored, the layout still in popOver mode. How can I achieve that? Do we get a king of Refresh or Redraw?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



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