平板电脑 WPF Windows 桌面应用程序 - 滚动问题 [英] Tablet WPF Windows Desktop Application - Scrolling issue
问题描述
我正在平板电脑 ASUS ME400 Intel Atom Z2760 上运行我的桌面应用程序 WPF.一切正常,但是当我使用 scrollviewer 时,在用手指滚动结束时用手指滚动移动(仅限水平平移模式),窗口移动,您会看到任务栏片刻.用手指滚动没有看到效果,直到在滚动条中找到才到达.
I'm running my desktop application WPF on tablet ASUS ME400 Intel Atom Z2760. All working properly, but when I use scrollviewer, scroll movement with finger (abilitate panning mode horizontalOnly) at the end of scroll with finger, the window moves and you see the taskbar for a moment. The effect is not seen if I scroll with my finger, did not arrive until founded in the scrollbar.
我怎样才能避免这个窗口移动?如何在滚动条末尾滚动时锁定我的窗口并且不允许移动?
How i can avoid this window movement? How I can lock my windows and do not permit to move when I scroll at the end of scrollbar?
推荐答案
在启用平移的 ScrollViewer
对象中,为 ManipulationBoundaryFeedback
注册一个新事件.
In the ScrollViewer
object, where you've enabled the panning, register a new event for ManipulationBoundaryFeedback
.
<ScrollViewer PanningMode="Both" ManipulationBoundaryFeedback="ScrollViewer_ManipulationBoundaryFeedback">
<!-- your content is here... -->
</ScrollViewer>
在代码隐藏中,您必须通过将 Handled
属性设置为 true
来处理事件:
In the codebehind, you have to handle the event, by setting the Handled
property to true
:
void ScrollViewer_ManipulationBoundaryFeedback(object sender, ManipulationBoundaryFeedbackEventArgs e)
{
e.Handled = true;
}
(通过将 Handled
属性设置为 true
,我们实际上是在告诉我们该事件已由我们处理,因此我们正在停止消息的冒泡过程在可视化树中,在它到达 Window
/Application
之前 - 以引起震动的为准.)
(By setting the Handled
property to true
, we are actually telling that the event has got handled by us, so we are stopping the message's bubbling process in the Visual Tree, before it would reach the Window
/Application
- whichever would cause the shaking.)
这篇关于平板电脑 WPF Windows 桌面应用程序 - 滚动问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!