this.Dispatcher.Invoke 的目的是什么,难道是跨线程? 可以声明 System.Collections.ObjectModel.ObservableCollection<T> ds 作为 ItemsSource 如果存在跨线程则在将数据 Add 到 ds 时 Dispatcher.Invoke(new Action<T>((item) => ds.Add(item)), 优先级, 传入的 item); 至于 item 的属性发生变化 则需要在定义 T class 的时候使用 INotifyPropertyChanged 接口 这样数据发生变化时,UI 显示就会自动改变了
8,731
社区成员
12,028
社区内容
加载中
试试用AI创作助手写篇文章吧