AvalonEdit WPF TextEditor (SharpDevelop): How to highlight a specific range of text?

后端 未结 4 924
温柔的废话
温柔的废话 2020-12-30 14:24

The incredibly awesome AvalonEdit WPF TextEditor control seems to lack an important feature, or at least i can\'t figure it out. Given an offset and a length, highli

4条回答
  •  不思量自难忘°
    2020-12-30 14:59

    Some background info: AvalonEdit is a code editor, not a rich text editor. There is no such thing as "highlight a portion of the document" - the document only stores plain text.

    Highlighting is computed on-demand, only for the lines currently in view. If you want custom highlighting, you need to add a step to the highlighting computation - this is what the ColorizeAvalonEdit class in the example posted by mzabsky is doing.

提交回复
热议问题