4

I'm using AvalonEdit in a Microsoft Surface application. Since the Contacts are handled a little bit different there than in a normal WPF application, I want to set the code selection programatically.

By code selection I mean this part of the code whichs background is changed if the user select it with the mouse.

I now the DocumentLine or the VisualLine where the selection should start and where it should end. But how can I now make this selection?

1 Answers1

3

this.Editor is AvalonEdit object, selectionStart is offset relative to the start of the text being edited.

        this.Editor.SelectionStart = selectionStart;
        this.Editor.SelectionEnd = selectionStart + selectionLength;
Matěj Zábský
  • 16,909
  • 15
  • 69
  • 114