We're migrating our WinForms SyntaxEditors to Wpf and we're hitting a snag with using data-binding and undo/redo.
When we used the WinForms editor and a programmatic change was made, we would do the following:This allowed us to update the syntax editor's text without its undo/redo stack being cleared. Additionally, it would add a UndoableModification item to its undo/redo stack.
When I try doing this with the Wpf SyntaxEditor, there appears to be a regression where updating text (that's bound to the SyntaxEditor's Text property) doesn't add a IUndoableTextChange to the UndoStack. Interestingly, the UndoStack's StackChanged event does fire, but the UndoStack remains empty.
Is this a bug?
If this is intentional, can we change this behavior to get a TextChange object added? (so programmatic changes can be undone).
If not, how might we meaningfully track programmatic changes so we can provide an undo/redo behavior for them?
Thanks,
-Craig
[Modified at 03/03/2011 04:36 PM]
When we used the WinForms editor and a programmatic change was made, we would do the following:
syntaxEditor.Document.ReplaceText(DocumentModificationType.ReplaceAll, 0, syntaxEditor.Document.Length, renderText);
When I try doing this with the Wpf SyntaxEditor, there appears to be a regression where updating text (that's bound to the SyntaxEditor's Text property) doesn't add a IUndoableTextChange to the UndoStack. Interestingly, the UndoStack's StackChanged event does fire, but the UndoStack remains empty.
Is this a bug?
If this is intentional, can we change this behavior to get a TextChange object added? (so programmatic changes can be undone).
If not, how might we meaningfully track programmatic changes so we can provide an undo/redo behavior for them?
Thanks,
-Craig
[Modified at 03/03/2011 04:36 PM]