WPF ScrollViewer 平移
我的窗口中有一个 ScrollViewer
对象,我想启用触摸功能。我已将其 PanningMode
设置为 HorizontalOnly
并且效果很好,但有两件事我需要问:
1)当 ScrollViewer
到达时当其内容结束时,整个窗口在触摸和滑动对象时移动。
2)我需要在滚动结束时触发一个事件,以便我可以更新一些 UI 内容。那是什么活动?
感谢您的帮助。
I have a ScrollViewer
object in my window that I want to be touch enabled. I have set its PanningMode
to HorizontalOnly
and it works good, but there are two things that I need to ask:
1) When the ScrollViewer
reaches the end of it's content, the whole window moves upon touching and swiping the object.
2) I need to fire an event when the scroll ends so that I can update some UI stuff. What's that event?
Thanks for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
1) 弹跳是 Windows 7 Touch 的默认行为,表示已到达可滚动列表的末尾。
2) 您可以在 ScrollChanged 事件上附加一个侦听器。 http://msdn.microsoft.com/en -us/library/system.windows.controls.scrollviewer.scrollchanged.aspx
要检查“滚动到底部”,请比较
VerticalOffset
(当前 Y 位置) ==ScrollableHeight
(绝对最大值)1) The bounce is the default behavior with Windows 7 Touch to indicate it's reached the end of a scrollable list.
2) You can attach a listener on the ScrollChanged event. http://msdn.microsoft.com/en-us/library/system.windows.controls.scrollviewer.scrollchanged.aspx
To check "scroll to bottom", compare
VerticalOffset
(current Y position) ==ScrollableHeight
(absolute maximium)在 ListView 中像这样配置 ScrollViewer 解决了窗口在滑出边界后移动的问题(问题#1):
Configuring the ScrollViewer like this in the ListView solved the problem (question #1) of the window moving after swiping out of boundaries for me (in case anyone find this useful):