Bookmark removal event

SyntaxEditor for WPF Forum

Posted 6 years ago by Daisuke Nakada
Version: 17.2.0664
Avatar

Hi,

I'm using the built-in bookmark indicator.

A bookmark is automatically removed when a line is deleted and this behivior is good for out product.

Please tell me how to detect automatic removal of a bookmark. Is there an event to do this?

Comments (4)

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

The only way to track that is to get the tagger that tracks the bookmark indicators and to watch its TagsChanged event.  The tricky thing about that is that it's lazily created only when a bookmark is first added to the document.  It's not available until after that.

This sort of code could be run the first time a bookmark is added to the document:

BookmarkIndicatorTagger tagger;
if (editor.Document.Properties.TryGetValue(typeof(BookmarkIndicatorTagger), out tagger))
    tagger.TagsChanged += BookmarkIndicatorTagger_TagsChanged;

TagsChanged will be fired whenever tags change over a region specified by the event args.  Note the event won't tell you which tags are removed, but you'd at least know the range to examine again to see if something is removed.


Actipro Software Support

Posted 6 years ago by Daisuke Nakada
Avatar

Thank you! Will TagsChanged occur also when a bookmark is automatically removed by deleting a line on the editor?

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Yes, any event that affects the tag range should fire the event.


Actipro Software Support

Posted 6 years ago by Daisuke Nakada
Avatar

Thank you.

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

Add Comment

Please log in to a validated account to post comments.