Stefan Stefan - 1 year ago 45
C# Question

Text coloring based on the position of text

I'm using AvalonEdit to create a textview which formats text like this:

Col 1 - Col 5 : FontStyle1

Col 6 - Col 12: FontStyle2


I've done this by overriding the ColorizeLine-Method of DocumentColorizingTransformer and then calling ChangeLinePart(...) for each segment of the line. It works, but for a large number of lines (~10000) it takes a very long time (> 10 seconds) to initialize the textview.

Is there a more efficient way to do this?

Answer Source

Setting ScrollViewer.CanContentScroll to true solved the issue.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download