Get text from current line with AvalonEdit

This snippets returns the content of the current line, where the user has its cursor:

int offset = AvalonEditor.CaretOffset;               
DocumentLine line = AvalonEditor.Document.GetLineByOffset(offset);
MessageBox.Show(AvalonEditor.Document.GetText(line.Offset, line.Length));

Werbung



comments powered by Disqus

Copyright Dunkel & Iwer GbR | Datenschutzerklärung | Impressum