C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...







How to open XAML pages from another XAML page ?



This chapter shows how to open a xaml page from another xaml page.



In a Silverlight application, you can have multiple XAML pages. When you use the .xap file in the web page, only one XAML control will be displayed at a time. The default XAML file displayed is determined by the following code in the App.xaml file:

this.RootVisual = new Page1();


You can change the above line to the class name of any oher xaml file to open that file by default.

Another scenario is, you may want to open different xaml files from the default xaml page. For example, consider that you have a xaml control that prompt user to enter login information. After the login credentials are validated, you may want to redirect to another xaml file when the user click the "Submit" button.

This can be done by setting the "Content" property of the xaml page.

private void SubmitButton_Click(object sender, RoutedEventArgs e)
{
this.Content = new NewXamlPage();
}


The above code shows how to set the "Content" property of the xaml control in the button click event handler. When the user click on the submit button, the new xaml file (NewXamlpage) will be opened and original xaml file will be recycled.

  • Next Chapter: Open a specific xaml page from a Silverlight control

  • Previous Chapter: How to set default .xaml page in a Silverlight control ?

  • Tutorial Index



  • dotNet Slackers

    About Us    Contact Us    Privacy Policy    Terms Of Use