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

MasterBehavior doesn't work for MasterDetailPage

$
0
0

Hi,

I'm playing with MasterDetailPage, however I've got a problem with property 'MasterBehavior', no matter what I set it always moves detail page to the right side, when I open it on iOS.

Is it some known issue?

Here is my code sample:

using System;
using Xamarin.Forms;

namespace MasterDetailPageNavigation
{
    public partial class MainPage : MasterDetailPage
    {
        public MainPage ()
        {
            InitializeComponent ();

            MasterBehavior = MasterBehavior.Split;
            Master = new MasterPage();
            Detail = new NavigationPage(new ContactsPage());

            (Master as MasterPage).ListView.ItemSelected += OnItemSelected;
        }

        void OnItemSelected (object sender, SelectedItemChangedEventArgs e)
        {
            var item = e.SelectedItem as MasterPageItem;
            if (item != null) 
            {
                Detail = new NavigationPage ((Page)Activator.CreateInstance (item.TargetType));
                (Master as MasterPage).ListView.SelectedItem = null;
                IsPresented = false;
            }
        }
    }
}

Viewing all articles
Browse latest Browse all 75885

Trending Articles



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