Solution 2 : Implementing GoToScreen Using Silverlight 3.0

You have two xaml pages named Screen1 and Screen2. On Screen1, there is a button named GoToScreen2Button. On Screen2, there is a button named GoToScreen1Button. Clicking on the GoToScreen2Button brings you to Screen2, and clicking on the GoToScreen1Button brings you to Screen1.

You could set the RootVisual property of Silverlight Application class to Screen1 if you want to go to it. Unfortunately, you cannot set the value of the RootVisual property more than one time from code. You can implement GoToScreen using the same concept of ASP.NET Master and Content Pages:

1.       Create a master screen.

2.       Add a Grid control named ContentGrid to the master screen. The grid control will be used as a content placeholder.

3.       In the master screen XAML code behind, create a method named GoToScreen.

4.       In the event handler for the Startup event of Application class, set the value of the RootVisual property to an instance of master screen.

5.       In the event handlers for the Click events of the GoToScreen1Button and GoToScreen2Button, call the GoToScreen method.



Comments have been disabled for this content.