Seems a simple enough task, but I'm stymied:
I want to direct the startup page of the app based on a LocalStorage setting.
I'm able to get (and set) LocalStorage without problem, but can't seem to find how to redirect.
app.xaml.cs does the usual:
public App()
{
InitializeComponent();
MainPage = new MainPage();
}
and MainPage.xaml.cs:
public MainPage()
{
InitializeComponent();
// set redirection page here
var navPage = GetLocalStorageValue(key: "startupPage", default: "/");
}
Thanks in advance!
You can use the
Commandto make the redirect. You can use the Command to pass theCommandParameterto the code behind then you can navigate to the page you want.Code in the MainPage.xaml.cs:
Code in the MainPage.xaml: