Windows Phone 10:多个SplitView.Pane

时间:2016-01-12 15:08:04

标签: windows-phone win-universal-app

在我的Windows手机应用程序中,我想要两个SplitView.Pane:一个在左边,一个在右边。

我已经SplitView.Pane添加了一个SplitView而没有任何问题,但当我尝试添加第二个SplitView.Pane时,Visual Studio会抱怨

  

属性窗格设置不止一次

<SplitView x:Name="MySplitView" DisplayMode="CompactOverlay"  IsPaneOpen="False" 
              CompactPaneLength="0" OpenPaneLength="200">
        <SplitView.Pane>
            <StackPanel Background="Gray">
                <ListView x:Name="listView" Padding="0,5,0,0"/>
            </StackPanel>
        </SplitView.Pane>
        <SplitView.Content>
            <Grid Background="White">
                <WebView x:Name="webProvider"
                 NavigationCompleted="webProvider_NavigationCompleted" />

            </Grid>

        </SplitView.Content>
        <SplitView.Pane>
        <StackPanel Background="Gray">
            <Button x:Name="HamburgerButton" Content="test"
                    Width="50" Height="50" Background="Transparent"/>
        </StackPanel>
        </SplitView.Pane>
    </SplitView>

有解决方法吗?

答案

Rowland Shaw有正确的想法将一个SplitView放入另一个。这是我用来实现这种安排的XAML。

<SplitView x:Name="MySplitView" DisplayMode="CompactOverlay"  IsPaneOpen="False" 
          CompactPaneLength="0" OpenPaneLength="220">
    <SplitView.Pane>
        <StackPanel Background="#555">
            <ListView x:Name="listView" Padding="0,5,0,0"/>
        </StackPanel>
    </SplitView.Pane>
    <SplitView.Content>

            <SplitView x:Name="RightSplitView" DisplayMode="CompactOverlay" IsPaneOpen="False"   
              FlowDirection="RightToLeft"  CompactPaneLength="0" OpenPaneLength="200">
                <SplitView.Content>
                    <Grid Background="White">
                        <WebView x:Name="webProvider"
             NavigationCompleted="webProvider_NavigationCompleted" />

                    </Grid>
                </SplitView.Content>
                <SplitView.Pane>
                    <StackPanel Background="#555">
                        <ListView x:Name="rightListView" Padding="0,5,0,0"/>
                    </StackPanel>
                </SplitView.Pane>
            </SplitView>

    </SplitView.Content>
</SplitView>

1 个答案:

答案 0 :(得分:1)

您的代码中有两个区域....你只能拥有自己的。如果你真的想要两个SplitViews。你必须在你的页面上添加两个控件。