my application, currently, goes to the MainPage.xaml
at startup (I don't know where it has configured though).
I want to be able to start with another page in some conditions. I think I can add this code to Application_Launching()
in App.xaml.cs
page:
NavigationService.Navigate(new Uri("/SecondPage.xaml", UriKind.Relative));
but NavigationService
is not available in App.xaml.cs.
How can I start the application with another page if foo == true
?
Changing start page in App.Xaml.cs
:
private void Application_Launching(object sender, LaunchingEventArgs e)
{
Uri nUri = new Uri("/SecondPage.xaml", UriKind.Relative);
((App)Application.Current).RootFrame.Navigate(nUri);
}
Setting static startup page in Property\WMAppManifest.xml
file
<DefaultTask Name ="_default" NavigationPage="SecondPage.xaml"/>
Try it:
private void Application_Launching(object sender, LaunchingEventArgs e)
{
Uri nUri = new Uri("/GamePage.xaml", UriKind.Relative);
RootFrame.Navigate(nUri);
}
and in Property\WMAppManifest.xml
clear NavigationPage:
<DefaultTask Name ="_default" NavigationPage=""/>