ScrollViewer.IsHorizo​​ntalRailEnabled =“False”或ScrollViewer.IsHorizo​​ntalRailEnabled =“True”无效

时间:2015-07-11 14:17:20

标签: xaml windows-8.1 winrt-xaml

我正在学习xaml而且我在Gridview。当我输入时我注意到了:

<GridView x:Name="Grid1" Grid.Row="1" SelectionMode="None"  Padding="120,0,0,0" RenderTransformOrigin="0.5,0.5" d:LayoutRounding="Auto"
              ScrollViewer.IsHorizontalRailEnabled="False">

<GridView x:Name="Grid1" Grid.Row="1" SelectionMode="None"  Padding="120,0,0,0" RenderTransformOrigin="0.5,0.5" d:LayoutRounding="Auto"
              ScrollViewer.IsHorizontalRailEnabled="True">

运行应用程序时没有区别。我想知道“ScrollViewer.IsHorizo​​ntalRailEnabled”是否真的做了什么,或者我做错了什么。 “ScrollViewer.IsVerticalRailEnabled”

也是如此

我去过MSDN,解释没有帮助。感谢。

2 个答案:

答案 0 :(得分:0)

如果您想要水平滚动,可以使用

ScrollViewer.HorizontalScrollBarVisibility = "Visible"

如果要垂直滚动,可以使用

ScrollViewer.VerticalScrollBarVisibility = "Visible"

答案 1 :(得分:0)

要启用水平滚动,您需要执行此操作

<GridView x:Name="Grid1" Grid.Row="1" SelectionMode="None"  Padding="120,0,0,0" RenderTransformOrigin="0.5,0.5" d:LayoutRounding="Auto">
<ScrollViewer HorizontalScrollBarVisibility="Auto" HorizontalScrollMode="Enabled">

<!-- Inside XAML code here -->

</ScrollViewer>
</GridView>

要启用垂直滚动,您需要执行此操作

<GridView x:Name="Grid1" Grid.Row="1" SelectionMode="None"  Padding="120,0,0,0" RenderTransformOrigin="0.5,0.5" d:LayoutRounding="Auto">
<ScrollViewer VerticalScrollBarVisibility="Auto" VerticalScrollMode="Enabled">

<!-- Inside XAML code here -->

</ScrollViewer>
</GridView>

希望这有帮助!