protected override void ClearItems() { var oldVal = this.Items.ToList(); _undoManager.AddUndoAction(() => { foreach (var it in oldVal) { base.Add(it); } }); base.ClearItems(); }
/// <summary> /// Call PropertyChanged event if not null /// </summary> /// <param name="property">Property that has changed</param> protected void NotifyPropertyChanged(string property, Action undoAction) { _undoManager.AddUndoAction(undoAction); NotifyPropertyChanged(property); }