我在ScrollViewer上看不到滚动条

时间:2016-05-01 07:19:33

标签: uwp-xaml

我在SplitView上显示可滚动列表。 滚动效果很好,但有一个问题。 enter image description here

如您所见,我看不到滚动条。 如果我使ScrollViewer变小,则会出现滚动条。但是当最大化时,我看不到它。

这是我的XAML代码。

<Page
    x:Class="Memoify.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Memoify"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.Resources>
        <Color x:Key="MainColor">#FFFFCC00</Color>
    </Page.Resources>

    <Grid x:Name="RootGrid"  Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <Rectangle HorizontalAlignment="Stretch" Height="48" Margin="0" Stroke="Black" VerticalAlignment="Top" StrokeThickness="0" Grid.Column="1">
            <Rectangle.Fill>
                <SolidColorBrush Color="{StaticResource MainColor}"/>
            </Rectangle.Fill>
        </Rectangle>

        <TextBlock x:Name="UICurrentCategory" Text="ALL MEMOS"  Style="{ThemeResource TitleTextBlockStyle}" Height="28" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="53,8,0,0" Grid.Column="1"/>
        <SplitView x:Name="UISplitView" DisplayMode="CompactOverlay" CompactPaneLength="0"  OpenPaneLength="320" Margin="0,0,-31,0" Grid.Column="1">
            <SplitView.Pane>
                <!-- NOTE: Below ScrollViewer shows scroll bar well -->
                <ScrollViewer  Margin="0,48,0,0">
                    <ListView x:Name="UIMenuList" Margin="0,0,0,0" IsItemClickEnabled="True"  ItemClick="UIMenuList_ItemClick"/>
                </ScrollViewer>
            </SplitView.Pane>
            <SplitView.Content>
                <ScrollViewer  Margin="0,48,0,0">
                    <ListView x:Name="UIMemoList" Margin="0,0,0,0" IsItemClickEnabled="True"  ItemClick="UIMenuList_ItemClick" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"/>
                </ScrollViewer>
            </SplitView.Content>
        </SplitView>
        <Button x:Name="UIMenuButton" HorizontalAlignment="Left" VerticalAlignment="Top" Click="OpenCloseMenu" FontFamily="{ThemeResource SymbolThemeFontFamily}" FontSize="20" Width="48" Height="48" Padding="0" UseSystemFocusVisuals="True" Content="&#xE700;" Grid.Column="1">
            <Button.Background>
                <SolidColorBrush Color="{StaticResource MainColor}"/>
            </Button.Background>
        </Button>

    </Grid>
</Page>

我相信ScrollView(或其中的ListView)的宽度有问题,但我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

只需删除保证金保证金=&#34; 0,0,-31,0&#34;在splitview上

它应该解决你的问题。 如果有,请你标记为已解决? 感谢