WPF 踩坑笔记10 ListBox异步动态加载
1.当ListBox内容很多时 可使用异步动态加载友好显示
private ObservableCollectiondetailImages = new ObservableCollection (); public ObservableCollection DetailImages { get { return detailImages ; } set { SetProperty(ref detailImages , value); } } ...
for (int i = 0; i < 10000; i++) { DispatherHelper.Dispatcher.Invoke(DispatcherPriority.Background, (Action)(() => { DetailImages.Add(image); })); }