SplitView在网格中

时间:2016-09-07 16:30:42

标签: c# wpf xaml

我希望我的SplitView在紧凑状态下不可见。但即使在紧凑状态和开放状态下,它也会占据很大的宽度。

<SplitView x:Name="svNav" DisplayMode="CompactOverlay">
    <SplitView.Content>
        <StackPanel Width="0" />
    </SplitView.Content>
    <SplitView.Pane>
        <Grid Name="lbPane" Width="auto" VerticalAlignment="Stretch">
            <ListView>
                <TextBlock FontSize="24">Mode</TextBlock>
                <ListViewItem>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock FontFamily="Segoe MDL2 Assets" VerticalAlignment="Center">&#xE80F;</TextBlock>
                        <TextBlock VerticalAlignment="Center" Margin="20,0">Standard Mode</TextBlock>
                    </StackPanel>
                </ListViewItem>
                <ListViewItem>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock FontFamily="Segoe MDL2 Assets" VerticalAlignment="Center">&#xE1E9;</TextBlock>
                        <TextBlock VerticalAlignment="Center" Margin="20,0">Scientific Mode</TextBlock>
                    </StackPanel>
                </ListViewItem>
                <ListViewItem>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock FontFamily="Segoe MDL2 Assets" VerticalAlignment="Center">&#xE117;</TextBlock>
                        <TextBlock VerticalAlignment="Center" Margin="20,0">Converter</TextBlock>
                    </StackPanel>
                </ListViewItem>
                <ListViewItem>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock FontFamily="Segoe MDL2 Assets" VerticalAlignment="Center">&#xE8EB;</TextBlock>
                        <TextBlock VerticalAlignment="Center" Margin="20,0">Programming Mode</TextBlock>
                    </StackPanel>
                </ListViewItem>
            </ListView>
        </Grid>
    </SplitView.Pane>
</SplitView>

设计中存在问题。请看看可以做些什么来解决问题 Preview of application

1 个答案:

答案 0 :(得分:0)

我找到了答案。拆分视图应该是页面和网格应该是单位内容的根元素。