我在 ScrollViewer 上看不到滚动条
I can't see scroll bar on ScrollViewer
我在 SplitView 上显示可滚动列表。
滚动工作正常,但有一个问题。
如您所见,我看不到滚动条。
如果我将 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="" Grid.Column="1">
<Button.Background>
<SolidColorBrush Color="{StaticResource MainColor}"/>
</Button.Background>
</Button>
</Grid>
</Page>
我认为 ScrollView(或其中的 ListView?)的宽度有问题,但我该如何解决?
只需在拆分视图上删除您的边距 Margin="0,0,-31,0"
它应该可以解决您的问题。
如果确实如此,您能否将其标记为已解决?
谢谢
我在 SplitView 上显示可滚动列表。
滚动工作正常,但有一个问题。
如您所见,我看不到滚动条。 如果我将 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="" Grid.Column="1">
<Button.Background>
<SolidColorBrush Color="{StaticResource MainColor}"/>
</Button.Background>
</Button>
</Grid>
</Page>
我认为 ScrollView(或其中的 ListView?)的宽度有问题,但我该如何解决?
只需在拆分视图上删除您的边距 Margin="0,0,-31,0"
它应该可以解决您的问题。 如果确实如此,您能否将其标记为已解决? 谢谢