Undo of resize fails

When I attempt to undo the last resize operation, the operation prior to the resize is undone. So it looks like node resize operations are not being captured by the undo manager. I believe it’s the same problem described in this thread. Looking at the model’s Changed event, when the transaction is committed the values for NewValue and OldValue are both null. So how do I can get the undo system to notice that a resize operation occurred and add it to the undo stack?


To be clear, I’m concerned strictly about WPF.

So you do have TwoWay data bindings of the resized element’s Width and Height properties, right? And they are bound to two properties of your data that raise the PropertyChanged event in the setter when the value changes, yes? And that they raise that event passing a ModelChangedEventArgs with the previous and the new property values?

And yet there’s no record of such changes in the UndoManager? I can’t explain that. Unless maybe someone set SkipsUndoManager to true, or maybe StartTransaction and CommitTransactions are not properly being paired.

I did not have the two-way binding. I looked at the DraggableLink sample and did something similar and undo now works, but now I’m forced to specify initial values for width and height. Previously I was letting the WPF layout system compute these values. I don’t suppose you have a solution for that one?

Does it work to use an initial value of NaN?

Not at all: my nodes wind up being infinitely small. Right now what I’m looking at doing is binding the size of the main element along with the margins used in the various layout containers up to the node model and then providing default values there. That approach is pretty horrible (since I’m specifying margins, a pure view level property, in my model), but it works.