对于RadComboBox、Listbox中数据过多出现加载过慢的问题
使用radcombobox的时候,数据过多使得加载、出现下拉过慢在radcombobox代码段中加入下面代码使得数据加载虚拟化可以加快加载速度
1 <telerik:RadComboBox x:Name="radComboBox">
2 <telerik:RadComboBox.ItemsPanel>
3 <ItemsPanelTemplate>
4 <VirtualizingStackPanel />
5 </ItemsPanelTemplate>
6 </telerik:RadComboBox.ItemsPanel>
7 </telerik:RadComboBox>
而Listbox有点区别需要在界面数据虚拟加载中再加个数据的虚拟加载即不用它自带的滚动条自己添加个滚动条ScrollViewer
Listbox
1 <ListBox >
2 <ListBox.Template>
3 <ControlTemplate>
4 <ScrollViewer VirtualizingStackPanel.VirtualizationMode="Recycling" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
5 <ItemsPresenter CacheMode="BitmapCache"/>
6 </ScrollViewer>
7 </ControlTemplate>
8 </ListBox.Template>
9 <ListBox.ItemsPanel>
10 <ItemsPanelTemplate>
11 <VirtualizingStackPanel Margin="6,0"/>
12 </ItemsPanelTemplate>
13 </ListBox.ItemsPanel>
14 </ListBox>

浙公网安备 33010602011771号