Windows UWP Pivot 轻扫 UI

Windows UWP Pivot swiping through UI

我有一个 Windows 通用 UWP 应用程序,我正在使用 Pivot 来让我能够从一个页面滑动到另一个页面进行导航。假设我有三个 UI 页(page1、page2 和 page3),然后我有三个 PivotItems,每个一个。问题是,在 PivotItem 内部,我目前在每个框架中都有一个框架,并且正在使用框架来显示 UI 页面。这是可行的,但是,这似乎是多余的,因为据我了解,框架用于动态显示 UI 等内容。看起来您将拥有网格中选项卡的 EITHER 按钮或链接,然后使用一个框架旋转 UI 视图,具体取决于单击哪个按钮或者您将使用 pivot,我正在这样做。我选择 pivot 的主要原因是,我的目标是移动设备,我确实希望能够从一个页面滑动到另一个页面。

所以,我不知道的是,在使用数据透视表时,我在每个数据透视表项中放了什么?每个框架是否正确?或者我应该使用其他项目,例如 UIElement?

谢谢!

What I want to know specifically is instead of stuffing controls directly in the PivotItem, how do I just have each PivotItem reference and use my other pages?

Pivot is a ItemsControl.so it can contain a collection of items of any type, including the Page。您可以像下面这样在 PivotItem 中使用页面:

<Page
x:Class="ProjectName.MainPage"
xmlns:local="using:ProjectName"
...
mc:Ignorable="d">

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Pivot x:Name="rootPivot" Title="Pivot Title">
        <PivotItem Header="Pivot Item 1">
            <!--reference the page with local:PageName-->
            <local:PageOne></local:PageOne>
        </PivotItem>
        <PivotItem Header="Pivot Item 2">
            <local:PageTwo></local:PageTwo>
        </PivotItem>
        <PivotItem Header="Pivot Item 3">
            <local:PageThree></local:PageThree>
        </PivotItem>
    </Pivot>
</Grid>