2

我正在使用 MSFT 的分组项目页面模板,并且出于特定原因想要禁用水平滚动。我通过设置 Scrollviewer.Horizo​​ntalScrollScrollbarVisibility = "Disabled" 来做到这一点。当我尝试向左或向右拖动屏幕时,它似乎被禁用,但当我使用鼠标滚轮时效果很好。你能帮忙看看如何在使用鼠标滚轮时防止水平滚动吗?

 <!-- Horizontal scrolling grid used in most view states -->
    <local:VariableGridView
    x:Name="itemGridView"
    AutomationProperties.AutomationId="ItemGridView"
    AutomationProperties.Name="Grouped Items"
    Padding="116,137,40,46"
    ItemsSource="{Binding Source={StaticResource groupedItemsViewSource}}"
    ItemTemplate="{StaticResource CustomTileItem}"
    SelectionMode="None"
    IsSwipeEnabled="False"
    IsItemClickEnabled="True"
    ItemClick="ItemView_ItemClick" Grid.RowSpan="4" Grid.ColumnSpan="2"
    ScrollViewer.HorizontalScrollBarVisibility="Disabled"    >
4

1 回答 1

0

您想要的是将 ScrollViewer 的 Horizo​​ntalScrollMode 属性设置为“禁用”。请参阅MSDN

你的 xml 应该是:

<local:VariableGridView
x:Name="itemGridView"
AutomationProperties.AutomationId="ItemGridView"
AutomationProperties.Name="Grouped Items"
Padding="116,137,40,46"
ItemsSource="{Binding Source={StaticResource groupedItemsViewSource}}"
ItemTemplate="{StaticResource CustomTileItem}"
SelectionMode="None"
IsSwipeEnabled="False"
IsItemClickEnabled="True"
ItemClick="ItemView_ItemClick" Grid.RowSpan="4" Grid.ColumnSpan="2"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.HorizontalScrollMode="Disabled"
>
于 2013-08-20T04:56:05.417 回答