I am using AvalonEditor inside a window dialog(WPF). Window dialog host TextEditor control. I have Find button explicit on Window. On click of Button, Search should work inside TextEditor. Can you please suggest how to bind Button Find to invoke TextEditor Search.
Currently, I have edited the TextEditor constructor to install the SearchPanel. And when Ctrl + F is pressed inside TextEditor, default search dialog appears. I want the same thing to work on Button click, but using MVVM approach.
Please suggest.
WPF XAML code
<Window>
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Left">
<Button Name="FindButton" Content="Find" Margin="2" Style="{DynamicResource ButtonFooter_Style}" >
<Button.CommandBindings>
<CommandBinding Command="ApplicationCommands.Find" CanExecute="CommandBinding_CanExecute">
</CommandBinding>
</Button.CommandBindings>
</Button>
<avalonEdit:TextEditor Grid.Row="2" Grid.Column="1" Name="textEditor"
FontFamily="Consolas"
FontSize="10pt"
SyntaxHighlighting="XML" ShowLineNumbers="True" >
</avalonEdit:TextEditor>
</Window>
TextEditor.cs class constructor already been edited
public TextEditor() : this(new TextArea())
{
Search.SearchPanel.Install(this.TextArea);
}
to have find feature enabled on pressing Ctrl + F
Now I want Find button to invoke Search feature without pressing Ctrl + F.
-Thanks