简体   繁体   English

在wrappanel WPF中使用虚拟化可以顺利滚动吗?

[英]Possible to get smooth scrolling WITH virtualization in wrappanel wpf?

I have a wrap panel that is virtualized using the following link: 我有一个使用以下链接虚拟化的包装面板:

http://virtualwrappanel.codeplex.com/ http://virtualwrappanel.codeplex.com/

I have implemented dragging and dropping on top that...howewver, when I drag items down, I am using the methods LineUp() and LineDown() to move down the wrap panel. 但是,我已经实现了拖放操作……但是,当我向下拖动项目时,我正在使用LineUp()和LineDown()方法向下移动环绕面板。 Because of virtualization this transition looks very choppy and not good...Is it possible to achieve smooth scrolling in this case? 由于虚拟化的原因,这种过渡看起来非常混乱而且不好……在这种情况下是否可以实现平滑滚动? Thanks 谢谢

It's likely that the items you're virtualizing are very expensive to render, either because of a complex visual tree or because of expensive code needed to produce them. 您正在虚拟化的项目很可能渲染起来非常昂贵,这可能是由于复杂的可视树或由于生成它们所需的代码昂贵所致。 Try testing the same number of items, but with a very simple display, say a TextBlock with Text="foobar" . 尝试测试相同数量的项目,但显示非常简单,例如说一个TextBlockText="foobar" This should scroll smoothly for you - at least it does for me. 这应该为您顺利滚动-至少对我来说如此。

So to debug your efficiency problem, you could take a look at the WPF performance suite and the Visual Studio performance analyzer (or similar 3rd party tools). 因此,要调试效率问题,您可以看一下WPF性能套件和Visual Studio性能分析器(或类似的第三方工具)。 The WPF performance suite will narrow down the general area of problem (is it actual rendering code? Or is the Dispatcher getting clogged up?) and the VS performance analyzer will help you find areas for streamlining in your own code if that happens to be the problem. WPF性能套件将缩小问题的总体范围(是实际的渲染代码?还是Dispatcher阻塞了?),而VS性能分析器将帮助您在自己的代码中找到需要精简的区域。问题。 If rendering is the problem, reducing your visual tree complexity will solve the issue. 如果存在渲染问题,那么降低视觉树的复杂性将解决此问题。

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

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