Chetan S
Chetan S

Reputation: 945

Navigation in Silverlight 5

I want to navigate to new page on the click event of Next button. Suppose my current page is "FirstTestPage.xaml" and want to go on the page "SecondTestPage.xaml" on click on nextButton_Click Event

private void RadButton_Click(object sender, RoutedEventArgs e)
{ 
    ///CODE HERE
}

And also want the back button which transfer me to FirstTestPage.xaml.

Thank You

Upvotes: 2

Views: 1929

Answers (1)

AlignedDev
AlignedDev

Reputation: 8232

Please see my answer to the question: Making a Wizard in Silverlight + Xaml

to quote it: "I would suggest looking into the Silverlight Navigation Framework. It allows you to use "urls" to navigate between "pages" (which are your XAML user controls). It also also users to use the back and forth buttons in the browser, which may or may not be something you want to allow.

There is a VS 2010 template when you choose New Project, Silverlight, "Silverlight Navigation Application" that will help get you started."

You can also use a border or panel in the Xaml and change the content of that. Here's an example using border. XAML

<Grid>
  <Border x:Name="contentBorder" />
</Grid>

Code Behind:

private void RadButton_Click(object sender, RoutedEventArgs e)
{ 
  this.contentBorder.Child = new SecondTestPage();
}

If you want to get fancy and have the Telerik controls (which I assume from your RadButton example) check out their transition control: http://demos.telerik.com/silverlight/#TransitionControl/FirstLook

Upvotes: 5

Related Questions