我显示主人的详细信息页面。
母版页有菜单项和详细信息页面的列表将所选项目的详细信息。
默认情况下,详细信息页面,在屏幕的左边显示的标题。我想自定义详细信息页面标题页面的中心显示。
反正是有定制的详细信息页面标题栏在Xamarin的形式?
选项1:
我认为titleview的(available since XF 3.2)是你在找什么。所有你需要做的就是创建一个你想有作为titleview的,它ASIGN到NavigationPage作为视图:
码
public class TitleViewPage : ContentPage
{
public TitleViewPage()
{
var titleView = new Slider { HeightRequest = 44, WidthRequest = 300 };
NavigationPage.SetTitleView(this, titleView);
...
}
}
XAML
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="NavigationPageTitleView.TitleViewPage">
<NavigationPage.TitleView>
<Slider HeightRequest="44" WidthRequest="300" />
</NavigationPage.TitleView>
...
</ContentPage>
选项2:
早在天,titleview的是可用之前我曾经简单地删除导航栏:
码
NavigationPage.SetHasNavigationBar(this, false);
XAML
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
...
NavigationPage.HasNavigationBar="False">
然后,我只是把我的NavigationPage一个StackLayout(我的自定义标题栏)的顶部,所有的图标/按钮/图片/文本格式的/ etc,我想。