积极答复者
如何实现像ListView那样的惯性滚动?

问题
答案
-
你好 jingjing.tang,
ListView的惯性滑动是因为ListView本身有对手指操作进行计算,然后让内置的ScrollViewer进行滑动,如果你想通过Direct2D的方式滑动的话,也是需要对手指运动进行跟踪和模拟。
举个例子来说如果手指起始点为A,离开点为B,计算从A到B所花的时间,然后进行计算可能列表会滑动到C,然后然ScrollViewer继续滚动到C点。具体ScrollViewer和ListViewer的逻辑我们目前无法得知。
--James
<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.- 已标记为答案 Jamles HezModerator 2014年11月5日 10:10
全部回复
-
你好 jingjing.tang,
ListView的惯性滑动是因为ListView本身有对手指操作进行计算,然后让内置的ScrollViewer进行滑动,如果你想通过Direct2D的方式滑动的话,也是需要对手指运动进行跟踪和模拟。
举个例子来说如果手指起始点为A,离开点为B,计算从A到B所花的时间,然后进行计算可能列表会滑动到C,然后然ScrollViewer继续滚动到C点。具体ScrollViewer和ListViewer的逻辑我们目前无法得知。
--James
<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.- 已标记为答案 Jamles HezModerator 2014年11月5日 10:10
-
hi jingjing.tang
我们可以通过对UIElement添加惯性的支持就可以实现像ListView那样的惯性
ManipulationModes里有对惯性三种介绍
//
// 摘要:
// 将惯性应用于转换操作。
TranslateInertia = 64,
//
// 摘要:
// 将惯性应用于旋转操作。
RotateInertia = 128,
//
// 摘要:
// 将惯性应用于缩放操作。
ScaleInertia = 256,在应用手势的时候添加相应的惯性支持就可以了。
比如:this.ManipulationMode = ManipulationModes.TranslateInertia。