Added an internal ObservableStack collection implementing INotifyCollectionChanged for UndoRoot's Undo and Redo stacks #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Nathan,
From the comments in the sample projects and my own experience binding UndoRoot’s UndoStack and RedoStack to ItemsSource properties in WPF, it would be a lot easier if these Stacks implemented INotifyCollectionChanged.
I found sample code for an ObservableStack collection posted on Stack Overflow which seems to fit the bill and have added this class to the MonitoredUndo project with an attributation comment at the beginning of the file linking back to the post on Stack Overflow.
I replaced Stack collection instances with ObservableStack instances in UndoRoot and added unit test methods to confirm that UndoRoot.UndoStack and UndoRoot.RedoStack implement INotifyCollectionChanged and raise CollectionChanged events correctly.
Finally, I removed the unnecessary manual refresh of the undo / redo stack collections in the sample projects, since the
Stacks now implement INotifyCollectionChanged.
Thank you for your time and consideration.
Regards,
Daniel O’Connell