Disable a few lines only

SyntaxEditor for WPF Forum

Posted 9 years ago by Tanja Lerbs - Germany
Version: 14.2.0610
Avatar

Hello,

i have a question.
I want to know if it is possible to deactivate or disable a few lines in the editor so that they can not be edited. 

The other lines should be enabled and it should be possible to modify the content.

Summarize: I have a text with some lines which can be changed and some line which can not be changed.

Thanks in advance!

Comments (4)

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

Hi Tanja,

If you handle the SyntaxEditor.DocumentTextChanging event, you can set e.Cancel = true if you see a text change operating coming in that would affect the lines that should be read-only.  That will cancel the change.  We also hope to add a feature specifically for read-only regions in a future version that will make this sort of thing even easier.


Actipro Software Support

Posted 9 years ago by Tanja Lerbs - Germany
Avatar

Hi,

thank you for the quick answer.

I have one more question:

Is it possible to highlight the disabled lines?

I know the method in the WinForms editor (for example: Editor.Document.Lines(index).BackColor = Color.Gray). I search for something like this in the WPF editor.

Thanks in advance!

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

Hello,

Yes you can do background highlighting using classification taggers.  Those allow you to tag a text range with a certain classification type and as long as that classification type is associated with a highlighting style that has a background, you should then see the background applied over the text range.  There is an option on the highlighting style where you can say whether the background should extend to the full width of the editor when a newline is encountered.  You'd probably want to include that.  Several of the Adornment QuickStarts show the use of classification taggers.


Actipro Software Support

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

Hello,

Read-only regions have been implemented and will be available in the WPF SyntaxEditor 2014.2 build 611 maintenance release.  They also will support optional highlighting so they can easily appear different from surrounding text.


Actipro Software Support

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