Over a million developers have joined DZone.

How to Specify the Startup Page in Windows Phone

DZone's Guide to

How to Specify the Startup Page in Windows Phone

· Mobile Zone
Free Resource

Download this comprehensive Mobile Testing Reference Guide to help prioritize which mobile devices and OSs to test against, brought to you in partnership with Sauce Labs.


Something that I get quite often is how do you specify the startup page in Windows Phone. Most people are trying to use the MVVM pattern and by default the MainPage.xaml lives in the root folder as shown below:


Most MVVM purist wants this folder to be clean, and only have the App.xaml and App.xaml.cs left. All of the Views should be located in the Views folder.

(You can move the LocalizedStrings.cs to a helper class)

How to do it?

I’ve found the easiest way to do is by deleting the MainPage.xaml file from the root of your project and adding it back to your Views (Add-New Item-Phone-Windows Phone Portrait Page). Then going to your WMAppManifest.xaml file found in Properties and changing the Navigation Page as shown below:


If you simply drag and drop the MainPage.xaml file, you will need to fix your x:Class in MainPage.xaml to point to the new location. So, in this case the project is named PhoneAppMVVM it would go from:




and the MainPage.xaml.cs file would need to be modified from:

namespace PhoneAppMVVM


namespace PhoneAppMVVM.Views

Now we have a nicely structured MVVM application that is easy to find what you are looking for fast! The final project solution should look like the following:



I hope this helped and until next time, Michael signing off.

Analysts agree that a mix of emulators/simulators and real devices are necessary to optimize your mobile app testing - learn more in this white paper, brought to you in partnership with Sauce Labs.


Published at DZone with permission of Michael Crump. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}