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

MasterDetailPage does not use all space when HorizontalOptions = FillAndExpand is set

$
0
0

Hi,

I have a simple MasterDetailPage:

public class ArticlesPage : MasterDetailPage
{
    private readonly IViewLocator _viewLocator;

    public ArticlesPage(IViewLocator viewLocator)
    {
        _viewLocator = viewLocator;
        CreateUI();
    }

// ReSharper disable InconsistentNaming
    private void CreateUI()
// ReSharper restore InconsistentNaming
    {
        Master = CreateMaster();
        Detail = CreateDetail();
    }

    private ArticleDetailPage CreateDetail()
    {
        return _viewLocator.ArticleDetailPage;
    }

    private ArticleMasterPage CreateMaster()
    {
        return _viewLocator.ArticleMasterPage;
    }

    protected override void OnAppearing()
    {
        IsPresented = true;
    }
}

On Android and iOS the MasterPage does not occupy all horizontal space it could have.

I use the following for startup:

// Android
SetPage(ViewLocator.Instance.ArticlesPage);

If I start directly with the ArticleMasterPage it uses all the space as I should. If used as shown, it does not.
All components and containers have HorizontalOption = LayoutOptions.FillAndExpand.

I'm wondering, why it does not work with the MasterDetailPage.

I tried setting WidthRequest to different numbers, but nothing changes.

Anyone can confirm this?

I'm using latest Xamarin.Forms Prerelease 2


Viewing all articles
Browse latest Browse all 58056

Trending Articles



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