WPF的ListBox加载大量图片卡死的有关问题
WPF的ListBox加载大量图片卡死的问题
问题如下:ListBox的Itemplate是我自己定义的usercontrol,每个usercontrol都有一个image,当加载listbox的时候(大概有200个左右usercontrol)会很慢,而且加载完成之后移动鼠标或者滚轮都会造成卡死!!
ListBox代码定义如下:
问题如下:ListBox的Itemplate是我自己定义的usercontrol,每个usercontrol都有一个image,当加载listbox的时候(大概有200个左右usercontrol)会很慢,而且加载完成之后移动鼠标或者滚轮都会造成卡死!!
ListBox代码定义如下:
<ListBox Grid.Column="1" Grid.Row="1" Name="_MonitorDisplayArea"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.VirtualizationMode="Recycling"
ScrollViewer.CanContentScroll="False">
<ListBox.CacheMode>
<BitmapCache EnableClearType="False"
RenderAtScale="1"
SnapsToDevicePixels="False"/>
</ListBox.CacheMode>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<local:MonitorState />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>