I have this page (TabbedPage) that creates two tabs:
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:Operacional.Views"
x:Class="Operacional.Views.MainPage">
<TabbedPage.Children>
<NavigationPage Title="Indicadores">
<NavigationPage.Icon>
<OnPlatform x:TypeArguments="FileImageSource">
<On Platform="iOS" Value="tab_about.png"/>
</OnPlatform>
</NavigationPage.Icon>
<x:Arguments>
<views:Indicadores />
</x:Arguments>
</NavigationPage>
<NavigationPage Title="Paineis">
<NavigationPage.Icon>
<OnPlatform x:TypeArguments="FileImageSource">
<On Platform="iOS" Value="tab_feed.png"/>
</OnPlatform>
</NavigationPage.Icon>
<x:Arguments>
<views:PaineisPage />
</x:Arguments>
</NavigationPage>
</TabbedPage.Children>
</TabbedPage>
What happens is that I'm not able to enable NavigationBar
or at least create a panel above the tabpages
. The ideal would be to enable NavigationBar
, this would be ideal for me. How it works. When you open App
, it drops to a login screen. When you log in, you enter MainPage
and TabPages
on it. If I try to exclude NavigationBar
it does not give any errors, but it does not display. Either she is hide or the TabPages
are "killing" her. Below my codes.
MainPage
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class MainPage : TabbedPage
{
public MainPage ()
{
InitializeComponent ();
NavigationPage.SetHasNavigationBar(this, true);
}
}
the login screen
public void Login_Clicked(object sender, EventArgs e)
{
LoginService svc = new LoginService();
LoginRS res = svc.Login(txtUsuario.Text, txtSenha.Text);
if (res != null && res.Success )
{
App.LooggedUser = res;
Application.Current.MainPage = new MainPage();
}
else if(res != null && ! res.Success)
{
lblErroLogin.Text = res.Exception;
}
else
{
lblErroLogin.Text = "Não foi possível realizar o Login, por favor verifique sua conexão com a Internet";
}
}
and my App.xaml.cs
public App()
{
InitializeComponent();
if (!IsUserLoggedIn)
{
MainPage = new NavigationPage(new LoginPage());
}
else
{
MainPage = new NavigationPage(new MainPage());
}
}