How to programmatically show new Search Overlay Pane

SyntaxEditor for WPF Forum

Posted 5 years ago by Bill L
Version: 19.1.0681
Avatar

Hey,

How do you programmatically show the new Search Overly Pane when a View is first created?

Best regards,

Bill

Comments (1)

Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Bill,

Our code for the Ctrl+F "find" edit action is basically:

// Update the find text
this.UpdateSearchOptionsFindTextFromSelection(view);

// If the editor is in multi-line mode...
if (view.SyntaxEditor.IsMultiLine) {
	// Ensure the search pane is open and active
	var searchPane = view.OverlayPanes[OverlayPaneKeys.Search] as SearchOverlayPane;
	if (searchPane != null) {
		searchPane.IsReplaceVisible = false;
		searchPane.SearchOptions = view.SyntaxEditor.SearchOptions;
	}
	else
		searchPane = view.OverlayPanes.AddSearch(false) as SearchOverlayPane;

	// Activate the pane
	if (searchPane != null)
		searchPane.Activate();
}

You should be able to use similar code for your needs.  But note that the Activate method call is to focus the "find what" TextBox.  You could leave that out if you are just wanting to show it but not focus it.

We will add this code listing to the documentation as well.

You also could execute our built-in edit action commands like EditorCommands.Find to do the same thing.


Actipro Software Support

The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.