[英]BitmapCache poor performance while resizing
I have a ListView
with different complex ListViewItem
containers consisting of images, shadow effects, blur effects.. etc. Rendering these containers in large amounts heavily reduces performance, especially since i'm using a blur overlay frame on top of the ListView
.我有一个
ListView
其中包含不同的复杂ListViewItem
容器,包括图像、阴影效果、模糊效果等。大量渲染这些容器会严重降低性能,尤其是因为我在ListView
顶部使用了模糊覆盖框架。 Which is why in this case i'm setting CacheMode
to BitmapCache
(improves performance by up to 15x the fps).这就是为什么在这种情况下我将
CacheMode
设置为BitmapCache
(将性能提高高达 15 倍的 fps)。
<Border.CacheMode>
<BitmapCache />
</Border.CacheMode>
The problem is that i use a WrapPanel
and a ValueConverter
to dynamically resize and fit these containers into the WrapPanel
so that they completely fill the space in either horizontal or tile views.问题是我使用
WrapPanel
和ValueConverter
来动态调整这些容器的大小并将其放入WrapPanel
以便它们完全填充水平或平铺视图中的空间。 Apparently, that doesn't work well with caching and it produces severe lags/stalls (frame drops to 0).显然,这不适用于缓存,并且会产生严重的滞后/停顿(帧下降到 0)。
Currently my 3 options are:目前我的 3 个选项是:
My questions:我的问题:
Ok.好的。 After a lot of reading and experimenting, i figured two things:
经过大量的阅读和实验,我想到了两件事:
First, Caching
should not be used on elements that resize frequently, especially if they're too many (couldn't find out why).首先,
Caching
不应该用于经常调整大小的元素,特别是如果它们太多(找不到原因)。 So, i basically cached fixed size child elements instead.所以,我基本上缓存了固定大小的子元素。
And that reminded me of Virtualization
which was exactly what i was missing but didn't know was supported in WPF Lists
.这让我想起了
Virtualization
,这正是我所缺少的,但不知道WPF Lists
支持。
With some more optimizations, now, i can resize the window buttery smooth.通过更多优化,现在我可以平滑地调整窗口的大小。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.