How to skip a specific undo

I have some data in the document which cannot be reverted back once changed (part of data is handled by external apps which I do not have control over). When user modifies such data by launching external app, I want to show that my graph document is modified. When user perfroms undo, I want to skip undo for these exterally generated data.

Currently, I am raising change event with custom hint to show that document has been modified. I have problem with undo where currently, I am just skipping undo for this action. Problem is at some point document shows that it is not modified anymore (as all undo's are done). How can I keep IsModified property of the document true?
For example user perfromed action A,B,C in sequence and B cannot be undone. When user does undo 3 times, it should undo C, B(skip undo), A.
And document's IsModified should show true.
It's customary for cases such as your "B" action not to record the state change in the GoUndoManager at all, rather than remembering it and then having Undo and Redo skip over those changes.

Part of the reason is that in your A,B,C scenario the user has to undo 3 times to return to the original state instead of just 2 times. That means that the second undo seems to have no effect, which can be confusing to users. And the same goes for Redo, of course.
Programs that have this issue sometimes prompt "this action can't be undone, are you sure?".

So when A,B,C actions occur, the GoUndoManager should just remember A,C.

You can accomplish this by temporarily setting either GoDocument.SkipsUndoManager or GoObject.SkipsUndoManager to true, depending on the scope of changes you want it to skip. (You can also override GoUndoManager.SkipEvent if your decision about skipping is more dynamic than just setting the SkipsUndoManager property, but that's rare.)
But, to answer your main question, you can try overriding GoUndoManager.Undo() to call the base method and then: if a "B"action had occurred sometime and if GoUndoManager.UndoEditIndex < 0, set GoDocument.IsModified to true. Of course you'll need to define your own boolean property to keep track of whether a "B" action has occurred.
it would look something like this:
public class SpecialUndoMgr : GoUndoManager {
public SpecialUndoMgr() {

public override void Undo() {
if (bHappened && this.UndoEditIndex < 0) {
foreach (GoDocument doc in this.Documents) {
doc.IsModified = true;
private bool bHappened = true;

note, UndoManager supports multiple documents, so we're using a shotgun here and setting them ALL to IsModified. If you only have 1 document, that's ok. If you have more, then you need to ponder this a bit.
also, we have a very simple definition for "B happened"... you obviously will want to flesh that out too.