2
我創建了一個包含大約1500個元素的組合框。 這個ComboBox在第一時間很慢,甚至用存儲過程填充集合 我該怎麼辦?與WPF中的許多元素的組合框性能
這裏有Code`
<ComboBox Name="cbMember" TextSearch.TextPath="MemberFullName" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" IsEditable="True" Height="23" VerticalAlignment="Center" Grid.Row="1" Grid.Column="1" Margin="5,0,0,0" ItemsSource="{Binding MemberCollection}" SelectedItem="{Binding Path=SelectedSearchMember,Mode=TwoWay,UpdateSourceTrigger=LostFocus}" KeyDown="cbMember_KeyDown" DropDownClosed="cbMember_DropDownClosed" SelectionChanged="cbMember_SelectionChanged">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding MemberFullName}" VerticalAlignment="Center" />
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>`
,並填寫觀察集合代碼在這裏
MemberCollection = new ObservableCollection<PROC_MembersList_Result>(_context.PROC_MembersCollectionList().Where(c => c.IsHide != null && (bool)c.IsHide == true));