I am using the default MasterDetailPage
navigation in my Xamarin app, where master is the side navigation and the detail are the contentpages the user can navigate to.
I already added the code to the MenuPage
:
public MenuPage()
{
InitializeComponent();
if (ProfilPage.loggedin)
{
ucet_stack.IsVisible = true;
ucet.IsVisible = true;
ucet.Text = "Váš účet " + ProfilPage.meno;
}
else
{
ucet_stack.IsVisible = false;
ucet.IsVisible = false;
}
}
I want to change the content of the MenuPage
after the user logs in. Constructor is only called the first time so it never changes. I tried to put the same code in onAppearing
but didnt work either. So what could I use to dynamically change the menu after the user logs in? Note I am pretty new to this.
UPDATE:
I created a second MasterDetailPage with new MenuPage and tried to change it in a contentpage which is detail, but it went blank
if(ProfilPage.loggedin)
{
Application.Current.MainPage = new MainLoggedPage();
}
var m = new MenuPage; m.method();
to update it? or if I choose the approach to create 2 master pages how can I switch master from a detail´s content page? – Chris Fodor