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
?
Here is a way to navigate depending on a condition:
In the constructor of App.xaml.cs add:
and then define RootFrameOnNavigating like this:
Another way will be to use a UriMapper to redefine what uri is navigated to when you navigate to a certain page.
Changing start page in
App.Xaml.cs
:Setting static startup page in
Property\WMAppManifest.xml
fileedit
Try it:
and in
Property\WMAppManifest.xml
clear NavigationPage: