Can I group undo items on the undo stack?

SyntaxEditor for WPF Forum

Posted 12 years ago by Craig - Varigence, Inc.
Version: 11.2.0552

Background Scenario:

Let's say I have a syntax editor control whose text is updated when an object's properties change. For instance, if an object has a width property and the user changes it in a property grid, the syntax editor's text would be updated to show the new value of width.

Now, let's further suppose that are some property changes that produce text changes that create more than 1 undo event. So, a single property change might generate N undo items on the syntax editor's undo stack.


Is there a way to group undo events (for a text change) tied to a single property change? The desire is that when a user presses Ctrl+Z to undo the property change, all the editor's undo items related to the change are processed, as opposed to only undo'ing the most recent text change? 

If there isn't a built-in mechanism for this, do you have any recommendations regarding how to accomplish this, or things to not do?



Comments (1)

Answer - Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Craig,

The document object model in WPF supports building a single text change that has numerous replace (or insert-only/delete-only) operations in it.  If you create a text change, you can append operations to it, then apply them all as a single unit.  That's the only way to group things for undo.  In that scenario, a single undo will undo all the operations in the text change.

Actipro Software Support

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.