How do I just select text and change the background style?

SyntaxEditor for WPF Forum

Posted 15 years ago by Joseph Feser
Avatar
I am trying to perform a very basic task, which is to go to a line of inside the editor and given two points on that line, change the background color. I need to do this for n number of selections in the document.

The Classifier demo is a very difficult way for me to implement this functionality.

What is the best way to implement this functionality?

Thank you,

Joe Feser

Comments (6)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Joe,

Eventually span indicators (like in our SyntaxEditor for WinForms product) would be the best way to implement those but we haven't gotten to that feature area yet. For the time being, classifiers are the only way to achieve it.


Actipro Software Support

Posted 15 years ago by Joseph Feser
Avatar
There does not seem to be any logic to how the text blocks are passed to the classify method. Sometimes it is one line, sometimes 20.

Is there a way to tell it to pass one line at a time?

Thanks

Joe Feser
Posted 15 years ago by Joseph Feser
Avatar
Am I stuck getting the Textrage back, looking at the string and trying to parse the item so I can figure out the real lines? I am not understanding how I get a lines collection back so I don't have to write 100 lines of code.

Thank you,

Joe Feser
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Joe,

I believe they are passed by line increments but we can't guarantee that will always stay that way.

You can use snapshotRange.Snapshot.PositionRangeToTextRange to convert your line/cols back to a TextRange.


Actipro Software Support

Posted 15 years ago by Joseph Feser
Avatar
Cool, that was the method I needed.

Do you know what happens if I give it a character longer than the line length?

So lets say line 40 has 20 chars and I ask for 1-30

Will it adjust and only give me 20 or will it overflow and give me 10 chars of the next line?

Thanks again,

Joe Feser
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I believe it will trim the character value based on the line length.


Actipro Software Support

The latest build of this product (v24.1.3) 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.