我正在努力隐藏TabbedNavigation页面的标题。
public class NavigationContainerNames
{
public const string AuthenticationContainer = "AuthenticationContainer";
public const string MainContainer = "MainContainer";
}
public partial class App : Xamarin.Forms.Application
{
public App()
{
InitializeComponent();
var maintTabNav = new FreshTabbedFONavigationContainer("Aerogrow", NavigationContainerNames.MainContainer);
maintTabNav.FirstTabbedPage.On<Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
maintTabNav.AddTab<AerogrowPageModel>("Aerogrow", "");
maintTabNav.AddTab<ControlsPageModel>("Controls", "");
maintTabNav.AddTab<AccountPageModel>("Account", "");
var LoginPage = FreshPageModelResolver.ResolvePageModel<RegisterPageModel>();
var LoginNav = new FreshNavigationContainer(LoginPage, NavigationContainerNames.AuthenticationContainer);
if (DataHelpers.DataBaseHelpers.GetCurrentUser() != null)
MainPage = maintTabNav;
else
MainPage = LoginNav;
}
我创建了FreshTabbed导航页面并在其中添加了子页面,但是在每个无法隐藏的选项卡中都有一个公共标题(带有“ Aerogrow”字样)。
如果有人知道如何隐藏它,请:)
注意:我试图隐藏低谷的XAML,但它不起作用
NavigationPage.HasNavigationBar="false"
答案 0 :(得分:1)
通过以下方式隐藏第一个选项卡式页面的导航栏:
var maintTabNav = new FreshTabbedFONavigationContainer("Aerogrow", NavigationContainerNames.MainContainer);
maintTabNav.FirstTabbedPage.On<Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
NavigationPage.SetHasNavigationBar(maintTabNav.FirstTabbedPage, false);
如果您不想在每个页面上看到导航栏,请使您的页面继承自基本页面。然后在基础页面中设置属性:
public class BasePage : ContentPage
{
public BasePage()
{
NavigationPage.SetHasNavigationBar(this, false);
}
}
答案 1 :(得分:-1)
使用容器 FreshTabbedNavigationContainer 代替FreshTabbedFONavigationContainer:
var maintTabNav = new FreshTabbedNavigationContainer(NavigationContainerNames.MainContainer);
maintTabNav.On<Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
在标签页中保留NavigationPage.HasNavigationBar =“ False”:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="App1.ControlsPage"
NavigationPage.HasNavigationBar="False">
<ContentPage.Content>
<StackLayout>
<Label Text="Welcome to Xamarin.Forms!"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage.Content>
</ContentPage>