scrolling 2 editors in tandem

SyntaxEditor for WPF Forum

The latest build of this product (v2020.1.1) was released 2 months ago, which was before this thread was created.
Posted 7 days ago by Andrew Levine
Version: 19.1.0684

I have two SyntaxEditors with slightly different versions of the same text inside, and would like to have the 2nd one scroll to the same place that the user scrolls to in the first one. I can't seem to find the proper events though.

Comments (2)

Answer - Posted 5 days ago by Actipro Software Support - Cleveland, OH, USA

Hi Andrew,

You'd probably want to attach to the editor.ActiveView.TextAreaLayout event.  That event fires whenever that particular IEditorView does a layout and its view lines will be created/measured/arranged.  This could be when scrolling other text changes occur.

The editor.ActiveView.ScrollState property returns the current scroll state in the active view.  So you could effectively sync up scroll states with something like this:


I hope that helps!

Actipro Software Support

Posted 4 days ago by Andrew Levine

Thanks, that works great! It doesn't sync up when the user types into the master editor and changes its scroll that way, but otherwise perfect. I can probably subscribe to DocumentChanged for that. -A

Add Comment

Please log in to a validated account to post comments.