Silverlight的xaml页面跳转实现步骤:
一、修改App.xaml文件
1,在App.xaml中添加一个全局变量:
Grid rootgrid=new Grid();
2,修改Application_Startup方法:
this.rootVisual=rootgrid;
rootgird.Children.add(new MainPage());
3,添加方法
public void RedirectTo(UserControl usercontrol)
{
App app = (App)Application.Current;
app.rootGrid.Children.Clear();
app.rootGrid.Children.Add(usercontrol);
}
二、添加页面跳转代码
App app = (App)Application.Current;
app.RedirectTo(new page2());