How to add custom user controls before the MainPage in Windows Store App

85 views Asked by At

I searched high and low for this question but without any luck. I am trying to build a Windows Store app, and I would like to add a custom user control before the MainPage loads, in other words, the custom user control has 2 buttons, one for entering the app and another one to exit it. How can I make the app display this user control first and then the MainPage ?

1

There are 1 answers

0
Corcus On

You can create a page to put the usercontrol in and set it as the startup page.

In App.xaml.cs in OnLaunched method you will find this line

rootFrame.Navigate(typeof(MainPage), e.Arguments);

What this says is "when the app starts go to MainPage". change this to

rootFrame.Navigate(typeof(MyUserControlPage), e.Arguments);

And you're ok.

Another solution would be not to change the navigation target on startup but to modify your MainPage to show a popup with your user control inside. :)

Hope this helps!