【发布时间】:2016-10-06 09:47:28
【问题描述】:
当使用 ListBox + WrapPanel 在 ListBox ItemsPanelTemplate 内的 WPF 中显示信息时,我的性能结果非常差。
如果我从 ListBox 中删除 WrapPanel,信息大约需要 5 秒 才能完全显示在 WrapPanel 中大约需要 1.10 分钟。
关于如何提高性能的任何提示?
配置是: 我的 DataTemplate 位于 App.xaml 中,并使用 1 个边框、网格、20 个文本块包裹在 6 个不同的 VirtualizingStackPanel 中。
列表框:
<ListBox Name="myListBox"
Margin="4"
BorderBrush="DarkSlateGray" BorderThickness="1"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ItemsSource="{Binding propList}"
ItemTemplate="{StaticResource myDataTemplate}" >
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
谢谢。
【问题讨论】:
-
见this。
标签: c# wpf wpf-controls