Silverlight Page Control Navigation

When you create a Silverlight 2.0 application the App.xaml.cs class’ OnStartup method sets the RootVisual to the page originally created at the time the solution was created. Unfortunately, the RootVisual can only be set once durring the life of the applciation.

17 private void OnStartup(object sender, StartupEventArgs e)

18 {

19 // Load the main control here

20 this.RootVisual = new Page();

21 }

If you leave the default application startup the way it is you will need to keep in mind that it can only be set once and are planning on separating out your UI into individual controls you will be stuck placing all your new controls in the default page and then hiding and displaying them as you need them. If you want to design you application with seperation of concerns as we all like to d0, and you want to place each of those controls in their own XAML Page you will need to alter the way in which the default application load happens.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s