[英]Disabling Mouse Wheel Scrolling in ItemsGrid View
我正在使用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" >
您想要的是將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"
>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.