private void SetDelegateView(ICollectionView collectionView) { if (delegateView == collectionView) { return; } IEnumerable <object> oldItems; if (delegateView != null) { delegateView.CollectionChanged -= OnDelegateViewCollectionChanged; delegateView.CurrentChanged -= OnDelegateViewCurrentChanged; oldItems = delegateView.Cast <object>(); } else { oldItems = new object[0]; } delegateView = collectionView ?? CollectionView.Empty; delegateView.CollectionChanged += OnDelegateViewCollectionChanged; delegateView.CurrentChanged += OnDelegateViewCurrentChanged; CollectionChanged.Raise(this, NotifyCollectionChangedEventArgs.Reset(oldItems, delegateView.Cast <object>())); CurrentChanged.Raise(this); }
private void SetCurrent(object item, int itemIndex) { if (this.currentItem == item && this.currentItemIndex == itemIndex) { return; } this.currentItem = item; this.currentItemIndex = itemIndex; CurrentChanged.Raise(this); }
private void bindingSource_CurrentChanged(object sender, EventArgs e) { if (_isProgrammFocus) { return; } var processObject = bindingSource.Current as ProcessObject; if (processObject != null) { CurrentChanged.Raise(this, processObject); } //OnCurrentChanged(new EventArgs<ProcessObject>(processObject)); }
public void OnDelegateViewCurrentChanged(object sender, EventArgs e) { CurrentChanged.Raise(this, e); }