如何在uwp中的Listview / Gridview中实现平滑滚动?即。当我滚动Listview / Gridview时,列表视图列表项不应该在鼠标滚动停止后立即停止,而是应该顺利停止。如何实现这一目标?
How to achieve smooth scroll in Listview/Gridview in uwp? ie. when I scroll Listview/Gridview, the listview listitems should not stop immediately after mouse scroll stops, rather, it should stop smoothly. How toachieve this?
推荐答案
第一件事就是有listview / gridview的默认滚动动画。当您在触摸设备中运行它时,您可以清楚地看到它。
The first thing is that there is default scroll animation for the listview/gridview. When you run it in a touch device you could see it clearly.
如果您需要向列表视图添加平滑滚动效果,您可能需要手动控制ScrollViewer listview的模板。你需要找到它并使用 ScrollViewer.changeView 方法滚动整个内容。你可以参考这个如何做到这一点:如何滚动到UWP中的元素。
If you need to add smooth scrolleffect to the listview, you might need to manually control the ScrollViewer in the listview's template. You need to find it and use the ScrollViewer.changeView method to scroll the whole content. You could refer this like about how to do that:How to scroll to element in UWP.
另一件事是,我不确定滚动功能是否会影响触摸设备中的默认滚动效果。
Another thing is that I'm not sure is that the scroll feature might affect the default scroll effect in a touch device.
祝你好运,
Roy
更多推荐
[UWP]如何在Listview / Gridview中实现平滑滚动?
发布评论