How to change current line and set background color?

SyntaxEditor for WPF Forum

Posted 8 years ago by ravi
Version: 13.2.0590
Avatar

I need to change current line dynamically and and set background color to that line.

How to do this one.

Comments (1)

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

Hi Ravi,

You would need to make a programmatic text change for the range of the line like this:

editor.Document.ReplaceText(TextChangeTypes.Custom, editor.Document.CurrentSnapshot.Lines[3].TextRange, "newtext");

For a line background color there are a couple ways to do that:

1) Make a classification tagger and put it over the line's range.  The highlighting style associated with the classification type you assign should have a background.  Some of the Adornments samples show that sort of thing.

2) Make a line-based indicator.  This might be the best way to go.  See samples and docs on indicators.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.