如何在列表框上设置OnManipulationDelta?

时间:2018-11-11 16:30:50

标签: wpf listbox touchscreen

我正在编写触摸屏应用程序。标准的ManipulationDelta只有3个像素,这意味着,如果我尝试在列表框上向左或向右滑动,则大多数情况下,列表框会开始向上或向下滚动。

在另一篇文章中,我读到您需要创建一个自定义列表框,该列表框继承自列表框,并覆盖OnManipulationDelta。

所以我正是这样做的:

    Protected Overrides Sub OnManipulationDelta(e As ManipulationDeltaEventArgs)
    'Console.WriteLine("Detected" & e.CumulativeManipulation.Translation.Length)

    If (Math.Abs(e.CumulativeManipulation.Translation.Y) > 35) Then
      OnManipulationDelta(e)
    Else
       e.Handled = True
    End If
End Sub

问题在于,只有在列表框上ScrollViewer.PanningMode =“ None”时才会触发OnManipulationDelta事件。

但这反过来意味着列表框不再向上或向下滚动。

如何设置更多可用的增量,同时仍然让列表框向上或向下滚动?

0 个答案:

没有答案
相关问题