1
I’m having a hard time creating a menu hamburger
because my MainPage
inherits from TabbedPage
. There is a way to do this with a TabbedPage
? To create this menu, we usually create two new pages(ContentPage
) and we passed the MainPage
to inherit from MasterDetailPage
and the builder of MainPage
do:
this.Master = new Master();
this.Detail = new NavigationPage(new Detail());
this would be the classic way. However as my MainPage
inherits from TabbedPage
cannot implement this. If you remove the TabbedPage
, lose page navigability by Tabs. I don’t even know if there’s a name TabbedPage
from within the MainPage
as MasterDetailPage
. Down with my MainPage
:
<?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>
and code Behind thereof
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class MainPage : TabbedPage
{
public MainPage ()
{
InitializeComponent ();
NavigationPage.SetHasNavigationBar(this, true);
//this.Master = new Master();
// NavigationPage.BarBackgroundColorProperty. = Color.Gray;
}
}
if I could leave the MainPage
free and rotate another page inside would also solve, but the question is: It has how to create a menu with a Mainpage inheriting from Tabbedpage?
Use Net Standard(Xamarin.Forms)
EDIT1
I made that code inside Mainpage
public MainPage ()
{
InitializeComponent ();
NavigationPage.SetHasNavigationBar(this, true);
Application.Current.MainPage = new MasterDetailPage
{
Master = new Master(), ==>> aqui o erro
Detail = new TabbedPage
{
Children =
{
new NavigationPage(new Indicadores()),
new NavigationPage(new PaineisPage())
}
}
};
// NavigationPage.BarBackgroundColorProperty. = Color.Gray;
}