xamarin UWP masterdetailpage width 如何设置

Posted

技术标签:

【中文标题】xamarin UWP masterdetailpage width 如何设置【英文标题】:xamarin UWP masterdetailpage width How to set 【发布时间】:2017-11-07 07:39:58 【问题描述】:

我有一个带有 xamairn 表单的程序,一个客户项目是 UWP。 MasterDetailPageMaster控件在androidios平台下外观正常,但在UWP平台下显得不友好。我知道我可以使用 Grid 来替换。但是,我不确定Masterdetailpage 中是否存在一些问题,或者我错过了一些使用它的关键过程。

在UWP是这样的:

【问题讨论】:

【参考方案1】:

但它在 UWP 平台中看起来不友好。我知道我可以使用 Grid 来替换。但是,我不确定 Masterdetailpage 中是否存在一些问题,或者我错过了一些使用它的关键程序。

如果您没有为MasterDetailPage 设置MasterBehavior。正如您所提到的,Master 将默认打开。请根据以下代码设置MasterBehavior。你会得到正常的外观。

<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms" 
                  xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
                  xmlns:local="clr-namespace:MasterDetailPageNavigation;assembly=MasterDetailPageNavigation"
                  x:Class="MasterDetailPageNavigation.MainPage" MasterBehavior="SplitOnPortrait">
</MasterDetailPage>

【讨论】:

完美,我刚刚为 android 添加了条件语句 MasterBehavior="Popover" 为 UWP 添加了 SplitOnPortrait

以上是关于xamarin UWP masterdetailpage width 如何设置的主要内容,如果未能解决你的问题,请参考以下文章

如何更改 Xamarin UWP 应用名称

Xamarin.UWP和Google Analytics

入口圆角 - Xamarin 形成 UWP

Xamarin.Forms UWP UI 测试

通过 Xamarin 在 UWP 上使用文本转语音

如何在 Visual Studio 2017 中执行 Xamarin.uwp