繁体   English   中英

如何在不同的XAML中设置XAML查看内容

[英]How to set up XAML View Content in Different XAML

我只是对Windows Universal App进行了编程,我想设置一个空的MainView.xaml来提供来自不同用户控件xamls的内容,就像在javafx中一样,然后在MainViewxaml.cs中即时切换,例如:

伪代码:

this.Content = Login.xaml

Main.xaml伪代码:

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <UserControl x:Name="UserControl"/>
</Grid>

我的问题是:

如何在Windows Universal应用程序中执行此操作?

使用框架和页面。 或者,如果您不想这样做,请使用ContentControl。

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <ContentControl x:Name="ContentControl">
        <UserControl x:Name="UserControl"/>
    </ContentControl>
</Grid>

而且,您可以说ContentControl.Content = new YourUserControl();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM