您的位置:首页 > 其它

Sliverlight change the scene

2010-04-13 15:57 232 查看
I study the sliverlight change the scene method today.

I found the this easy job, because I think this isn't easy before.

So I show step to you :

1) modify the "app.xaml"

private void Application_Startup(object sender, StartupEventArgs e)
{
Grid g = new Grid();
this.RootVisual = g;
MainPage p = new MainPage();
g.Children.Add(p);
}


2) modify your page(scene)

for example: the mainPage.xaml

private void myButton_Click(object sender, RoutedEventArgs e)
{

Grid root = Application.Current.RootVisual as Grid;
if (root != null)
{
root.Children.RemoveAt(0);
root.Children.Add(new Page1());  // change current page to page1
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: