Hi guys can anyone tell me how to do this... I have a Silverlight application with two XAML pages. On the first one I have a button. When t开发者_开发问答he button is clicked I would like to redirect the user to the second XAML page.
How can I accomplish this?
This is what i have so far:
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
this.HelloMessage.Text = "Hello Universe";
}
private void button1_Click(object sender, RoutedEventArgs e)
{
}
private void HelloMessage_Loaded(object sender, RoutedEventArgs e)
{
MessageBox.Show("This is the load event for this page");
}
}
If you really have a need to navigate from one XAML page to another, this will set you in the right direction: Silverlight Navigation Overview. I would say, however, that in a Silverlight app, if you're simply trying to display different content on the page, you don't generally follow the standard web navigation paradigm.
Application.Current.RootVisual = new MySecondPage();
where MySecondPage is the xaml page to which you want to navigate to.
精彩评论