FoldFence
FoldFence

Reputation: 2802

How to set up XAML View Content in Different XAML

I just programm a Windows Universal App and I want to set up an empty MainView.xaml witch provides the content from different User Control xamls just like in javafx and switch then on the fly in the MainViewxaml.cs like:

Pseudo Code:

this.Content = Login.xaml

Main.xaml Pseudo Code:

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

My Question is:

How can I do this in a Windows Universal app ?

Upvotes: 0

Views: 77

Answers (1)

Tam&#225;s Deme
Tam&#225;s Deme

Reputation: 2228

Use a frame and pages. Or if you don't want to do that, use a ContentControl.

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

And than you can say ContentControl.Content = new YourUserControl();

Upvotes: 1

Related Questions