Xamarin.Forms MasterDetailPage覆盖IsPresent

时间:2017-04-05 18:35:33

标签: xamarin xamarin.forms

我尝试将MasterDetailPage设置为始终在平板电脑布局上显示MasterPage:

    public MainPage()
    {
        InitializeComponent();
        if (Device.Idiom == TargetIdiom.Phone)
        {
            this.MasterBehavior = MasterBehavior.Popover;
        }
        else
        {
            this.MasterBehavior = MasterBehavior.Split;
        }
    }

然而,汉堡包图标仍然显示,点击它时我收到错误Can't change IsPresented when setting Split。如何覆盖IsPresented属性?我试图将方法绑定到IsPresentedChanged,但只有在IsPresented值更改后才会触发事件,而不是之前 - 因此我仍然会遇到异常。

1 个答案:

答案 0 :(得分:0)

我无法发表评论,因此不得不将此作为答案。

在将行为设置为拆分之前,您可以设置IsPresented = true吗?

因为这应该使母版页可见,而不是汉堡包图标。

相关问题