To start the app with the view the user has choosen, there are two steps necessary.
First step is to select the right view in the App.xaml.cs file and set it as root frame element. Do this in the Application_Launching method. Here is an example:
private void Application_Launching(object sender, LaunchingEventArgs e)
{
Uri uri;
// Read the user settings
var views = IsolatedStorageProvider.LoadViewSettings();
// Month view
if (views.ShowMonthView)
{
uri = new Uri("/MonthViewPage.xaml", UriKind.Relative);
}
else
{
// Week view
if (views.ShowFiveDaysWeek)
{
uri = new Uri("/FiveDaysPage.xaml", UriKind.Relative);
}
else
{
uri = new Uri("/SevenDaysPage.xaml", UriKind.Relative);
}
}
// Set the start page
((App)Application.Current).RootFrame.Navigate(uri);
}
Everything looks ok, but the app does not start with the right view. There is one more easy step to do. In the WMAppManifest.xml file, the DefaultTask tag needs an empty NavigationPage property. So just delete the default entry MainPage.xaml.
<Tasks>
<!--This is set in code (App.xaml.cs)-->
<DefaultTask Name="_default" NavigationPage="" />
That's it, hope that helps.
3 comments:
How to get the ColorPickerPage.xaml for windows phone 7 ???
Sorry, but I don't get the question. Can you please let me know, how I can help you.
Thanks to you share with me this nice blog.So keep it up..
Post a Comment