Event when scrolling vertically

SyntaxEditor for WPF Forum

Posted 3 years ago by Daniel Constantin - ModuleWorks GmbH
Version: 19.1.0687
Avatar

Hi,

I need an event when scrolling vertically to get the visible lines.

I want to create something with 2 editors (left and right) like a diff viewer. Something like winMerge.

Kind regards,

Daniel

Comments (4)

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

Hi Daniel,

The IEditorView.TextAreaLayout event fires any time a layout occurs, which could be due to scrolling, editor resizing, zooming, or just changes in the document that require a repaint. You should be able to listen to that event to keep your side-by-side views in sync.

You can find details about the available data exposed by the event here:

https://www.actiprosoftware.com/docs/controls/wpf/api/actiprosoftware.windows.controls.syntaxeditor.textviewtextarealayouteventargs

Please let us know if you are unable to achieve what you need based on that event.


Actipro Software Support

Posted 2 years ago by Daniel Constantin - ModuleWorks GmbH
Avatar

Hi,

That event is what I need.

Also, is there a way to set the FirstVisiblePosition? If I scroll on the left editor and I know which is the FirstVisiblePosition, I also want to set that somehow on the right editor.

Kind regards,

Daniel

Posted 2 years ago by Daniel Constantin - ModuleWorks GmbH
Avatar

Hi,

I have a solution but this is not behaving like I would want because I need the caret to stay where it is when scrolling.

Now I am setting the CaretPosition and then I scroll the line to visible top.

ActiveView.Selection.CaretPosition = new TextPosition(firstVisibleLine, 0);

ActiveView.Scroller.ScrollLineToVisibleTop();

Kind regards,

Daniel

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

Hi Daniel,

The editor.ActiveView.ScrollState property returns a TextViewScrollState object that has all the information about how the view's scroll state is anchored and positioned.

You can call editor.ActiveView.Scroller.ScrollTo(scrollState) to set a TextViewScrollState on another view.

The Scrolling documentation topic covers these APIs if you want to reference that.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.