How to subscribe to the scroll event of Editor.

SyntaxEditor for WPF Forum

Posted 3 years ago by Sunshine - Appeon
Version: 21.1.1

I don't seem to find that the editor can subscribe to scroll events.
I need an event that changes only when the scroll bar is scrolled or the visible area range changes.

In this way, I want to realize the code coloring function of the current visible area.

For me, getting ClassificationTag data is a time-consuming request and should not be executed through the main thread. So I want to know that the current visible area has changed in the event, and then use a background thread to get the data and update the ClassificationTag data.

Comments (1)

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


Each view has a TextAreaLayout event that fires as a layout occurs.  The layout could have been triggered by scrolling, text edits, view size changes, etc.  

If you are trying to only supply classification tag data for the visible view lines, then you can use taggers to do so without having to deal with that event.  A CollectionTagger will store pre-defined tags, which is NOT what you would want to do for your scenario.  Whereas a normal tagger such as the ColorPreviewTagger in our AdornmentsColorPreview QuickStart just tags the view lines being created/updated in the TextAreaLayout and nothing else.  That way, you are efficiently tagging only what's visible.

Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.