Reputation: 1
I am looking into the documentation of AvalonEdit - http://avalonedit.net/documentation/, Which contains all sorts of useful functionalities and method calls.
I am not sure how to call and apply them. An example could be
public static readonly RoutedCommand RemoveLeadingWhitespace
And I am not sure how to execute it, so it removes the trailing whitespace in my text editor instance.
I've tried with
avalonEditInstance.RemoveTrailingWhitespace();
The return type of the method is RoutedCommand, so I also tried.
RoutedCommand routedCommand = AvalonEditCommands.RemoveTrailingWhitespace;
routedCommand.Execute(avalonEditInstance,avalonEditInstance);
What is the correct way of calling these methods, as I didn't find it in their documentation?
Upvotes: 0
Views: 79
Reputation: 16439
You need to execute commands on avalonEditInstance.TextArea
RoutedCommand routedCommand = AvalonEditCommands.RemoveTrailingWhitespace;
routedCommand.Execute(null, avalonEditInstance.TextArea);
It's generally the TextArea
control that gets focussed and is doing all the command-handling.
Upvotes: 1