When a piece of text containing an anchor is removed, then that anchor will be deleted. First, the IsDeleted property is set to true on all deleted anchors, then the Deleted events are raised. You cannot retrieve the offset from an anchor that has been deleted.
This deletion behavior might be useful when using anchors for building a bookmark feature, but in other cases you want to still be able to use the anchor. For those cases, set SurviveDeletion = true.
Due to the 'weak reference' nature of text anchors, you will receive the Deleted event only while your code holds a reference to the TextAnchor object.
Assembly: ICSharpCode.AvalonEdit (Module: ICSharpCode.AvalonEdit.dll) Version: 184.108.40.20638