我想使用 xaml 在主详细信息页面中显示页面标题。我尝试在 MasterDetailPage、MasterDetailPage.Master、 内添加 x:Name 和 x:Title 属性MasterDetailPage.Details 标记。但这些都不起作用。这是 xaml:
<?xml version="1.0" encoding="utf-8" ?>
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MSCommunity_Xamarin"
xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
prism:ViewModelLocator.AutowireViewModel="True"
x:Class="PrismUnityApp3.Views.MainPage"
x:Name="Page title">
<MasterDetailPage.Master>
</MasterDetailPage.Master>
<MasterDetailPage.Detail>
</MasterDetailPage.Detail>
最佳答案
仅对 NavigationPage
中嵌入的页面显示页面标题,并且正在查找的属性是 Title
(不是 x:Title,不是 x:Name)。
将 MDP 嵌入 NP 没有多大意义。通常的模式是在 NavigationPage
中设置一堆 ContentPage
(设置了 Title
)作为 Detail
MasterDetailPage
的。 MDP 是您的 Application.MainPage
关于xaml - 如何使用 xamarin.forms 中的 xaml 在主详细信息页面中显示页面标题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41973919/