在C#UWP应用程序中如何禁用滚动查看器上的指针轮,并且仍能够通过触摸移动滚动?
我有这样的情况:
<ScrollViewer
VerticalScrollMode="Disabled"
VerticalScrollBarVisibility="Disabled"
HorizontalScrollMode="Enabled"
HorizontalScrollBarVisibility="Hidden"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch">
<ListView/>
</ScrollViewer>
有什么想法吗?
答案 0 :(得分:1)
如果您指定了焦点条件,则在您的代码后面应该覆盖您的鼠标滚轮输入。
public MyView()
{
this.InitializeComponent();
Window.Current.CoreWindow.PointerWheelChanged += CoreWindow_PointerWheelChanged;
}
private void CoreWindow_PointerWheelChanged(CoreWindow sender, PointerEventArgs args)
{
if (!SomeConditionLikeYourScrollViewerIsFocused)
{
args.Handled = true;
}
else { // do nothing }
}