silverlightナビゲーションは伝統的な批改容器のConttentやChildなどをまとめて適用してナビゲーションを実現します。
1651 ワード
参考文献:http://www.mysjtu.com/page/M0/S590/590938.html
第一の方法:容器のルート要素を修正する。
この方法は同じページのコラムを使ってナビゲータを行います。例を挙げてください。
.xamlページ
第一の方法:容器のルート要素を修正する。
この方法は同じページのコラムを使ってナビゲータを行います。例を挙げてください。
.xamlページ
<Grid x:Name="LayoutRoot"></Grid>
.cs
LayoutRoot.Children.Clear();
LayoutRoot.Children.Add(new Page());
( ) , 。
: RootVisual
, :
App.cs
public Grid rootGrid = new Grid();
private void Application_Startup(object sender, StartupEventArgs e)
{
UserControl startpage = new nav1();
this.RootVisual = rootGrid;
rootGrid.Children.Add(startpage);
}
nav1.xaml
<Grid x:Name="LayoutRoot" Background="White">
<Button Content=" " Width="100" Height="40" Click="Button_Click"></Button>
</Grid>
nav1.cs
App app =(App)App.Current;
app.rootGrid.Children.Clear();
app.rootGrid.Children.Add(new MainPage());