Avalonedit How To Cancel Line Transformers

I added LineTransformerClass, which is derived from DocumentColorizingTransformer in TextEditor:

TxtEditCodeViewer.TextArea.TextView.LineTransformers.Add(new ColorizeAvalonEdit());

Is there any programmatic way to call invalidation in Linetransformer?

I readily suggested that since it is added to the text view, the following should work:

TxtEditCodeViewer.TextArea.TextView.InvalidateVisual();
TxtEditCodeViewer.TextArea.TextView.InvalidateArrange();
TxtEditCodeViewer.TextArea.TextView.InvalidateMeasure();

But they do not. Just in case, I also tried the following:

//TxtEditCodeViewer.TextArea.TextView.InvalidateVisual();
//TxtEditCodeViewer.TextArea.TextView.InvalidateArrange();
//TxtEditCodeViewer.TextArea.TextView.InvalidateMeasure();
//TxtEditCodeViewer.InvalidateVisual();
//TxtEditCodeViewer.InvalidateArrange();
//TxtEditCodeViewer.InvalidateMeasure();
//TxtEditCodeViewer.TextArea.InvalidateArrange();
//TxtEditCodeViewer.TextArea.InvalidateMeasure();
//TxtEditCodeViewer.TextArea.InvalidateVisual();
+5
source share
2 answers

The text view supports the cache of generated visual lines. Forcing WPF to redraw the control simply forces it to reuse the results in the cache and no longer calls your linear transformer.

TextView.Redraw :

textEditor.TextArea.TextView.Redraw(segment); // invalidate portion of document
textEditor.TextArea.TextView.Redraw(); // invalidate whole document

ElementGenerators, LineTransformers.

BackgroundRenderers . , :

textEditor.TextArea.TextView.InvalidateLayer(this.Layer);
+12

. ...

, ( ):

if (Txtpreview.TextArea.TextView.LineTransformers.Count > 2)
{
    Txtpreview.TextArea.TextView.LineTransformers.RemoveAt(1); // removes selection highlight
}
Txtpreview.TextArea.TextView.LineTransformers.Add(new MarkSameWord(Txtpreview.SelectedText));
0

All Articles