WPF SyntaxEditor how to place the caret at specified position?

SyntaxEditor for WPF Forum

Posted 3 months ago by Murali Mahendra Kumar Banala
Version: 19.1.0681
Avatar

Hi 

I have just upgraded the code from version v16.1.0631 to the v19.1.0681 and found that I'm unable to set the caret position of the syntaxEditor to specified location. Here was my earlier code:

IEditorView view = this.syntaxEditor.ActiveView;
view.SyntaxEditor.Caret.Position = new TextPosition(lineNumber, 0);

Now I see that Caret property is not available, how to set the caret position to the desired line number and location?

Thanks in advance

Comments (2)

Posted 3 months ago by Murali Mahendra Kumar Banala
Avatar

Okay found that it can achieved through

syntaxEditor.ActiveView.Selection

syntaxEditor.ActiveView.Selection.CaretPosition = new TextPosition(lineNumber - 1, 0);

Hope this is correct way of implementation.

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

Hello,

Yes that is correct.  We made some breaking changes in 2019.1, but documented all of them.  Please see the "SyntaxEditor / Converting from Previous Versions / Converting to 2019.1" topic in the documentation that comes with the product.  That walks through everything that was changed.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.