我正在使用MSFT中的分组项目页面模板,并希望因特定原因禁用水平滚动。我通过设置Scrollviewer.HorizontalScrollScrollbarVisibility =“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" >
答案 0 :(得分:0)
你想要的是将ScrollViewer的HorizontalScrollMode属性设置为“Disabled”。请参阅MSDN。
你的xaml应该是:
<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"
>