简体   繁体   English

WP7滚动时更新UI(芒果)

[英]WP7 Updating the UI while scrolling (Mango)

A while back I wrote a Windows Phone 7 Jump List control: 前一段时间,我写了一个Windows Phone 7跳转列表控件:

http://www.scottlogic.co.uk/blog/colin/2011/01/a-windows-phone-7-jump-list-control/ http://www.scottlogic.co.uk/blog/colin/2011/01/a-windows-phone-7-jump-list-control/

I have had a number of requests from people to add a 'mango' style 'sticky' category header at the top of the jump list. 我收到了许多人的请求,要求在跳转列表的顶部添加“芒果”样式的“粘性”类别标题。 I have added a category header to the top of the control and have worked out how to update its location so that it slides into place as the list scrolls, however, Mango is causing me a few issues ... 我在控件的顶部添加了一个类别标题,并研究了如何更新其位置,以便它在列表滚动时滑入到位,但是,Mango给我带来了一些问题...

With NoDo, I update my UI as the ScrollViewer scrolls by locating the Scrollbar within the ScrollViewer template and handling the ValueChanged event. 使用NoDo,我可以通过在ScrollViewer模板中找到Scrollbar并处理ValueChanged事件来在ScrollViewer滚动时更新UI。 This works fine on my NoDo phone. 在我的NoDo手机上可以正常使用。

However, I have the Mango developer tools, and when I run the same code in the emulator, the 'sticky' category header location jumps rather than moving smoothly. 但是,我有Mango开发人员工具,当我在模拟器中运行相同的代码时,“粘性”类别标题位置会跳跃而不是平滑移动。 My guess is that this is in some way related to the scrolling improvements in Mango, is the UI being updated via the render / compositor thread without the ValueChanged event being fired? 我的猜测是,这在某种程度上与Mango的滚动改进有关,是否通过render / compositor线程更新了UI,而没有触发ValueChanged事件?

I have also tried updating the UI via CompositionTarget.Rendering, again this is jumpy in Mango. 我也尝试通过CompositionTarget.Rendering更新UI,这在Mango中还是很容易的。 Also, with WP7 controls not implementing IDisposable, it is hard to determine when to remove the subscription to this event. 同样,由于WP7控件未实现IDisposable,因此很难确定何时删除对此事件的订阅。

So, does anyone have an idea how I can solve this issue? 那么,有谁知道我如何解决这个问题? How can I smoothly update my UI in response to vertical scrolling on a Mango WP7 device? 如何响应芒果WP7设备上的垂直滚动而顺利更新UI?

You can opt out of the mango performance improvements for scrolling by setting ScrollViewer.ManipulationMode="Control" attached property as described on the Silverlight for Windows Phone Performance team blog . 您可以通过设置ScrollViewer.ManipulationMode="Control"附加属性来选择不进行芒果性能滚动,如Silverlight for Windows Phone Performance团队博客中所述 I would expect this to resolve the problems you've been having. 我希望这可以解决您遇到的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM