简体   繁体   中英

Is there a way to include one xaml page as a part into another?

I'm trying to make a page comfortable for portrait and landscape. So, in portrait it will have two separate pages, in landscape - two frames where first and second pages will be visible at the same time. So, is there a way to implement it? I mean xaml and code behind.

A XAML page can be included in another one just like any other control.

<Page x:ClassName="MyUberMetaPage" ...>

    <Grid ...>

        <local:MyPage1 x:Name="LeftPage" Grid.Column="0" />
        <local:MyPage2 x:Name="RightPage" Grid.Column="1" />

    </Grid>

</Page>

In MyUberMetaPage's code-behind you'll want to show/hide things as necessary based on window size, or more likely, dynamically create LeftPage and RightPage and add them to the UI (so you aren't constructing pages and then not actually showing them).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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