protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e) { if (_IsUpdate) { return; } GUIThreadHelper.Invoke(() => RaiseCollectionChanged(e)); }
/// <summary> /// 更新集合内容,更新完成后统一通知集合变更。 /// </summary> /// <param name="call"></param> public void BeginUpdate(Action call) { try { _IsUpdate = true; GUIThreadHelper.Invoke(() => { call(); base.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); }); } finally { _IsUpdate = false; } }