In This Article

SearchViewBase Class

Provides the abstract base class for a view with editor-searching UI.

[TemplatePart(Name = "PART_CloseButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "PART_FindAllButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "PART_FindNextButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "PART_FindWhatTextBox", Type = typeof(TextBox))]
[TemplatePart(Name = "PART_MatchCaseButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "PART_MatchWholeWordButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "PART_ModeToggleButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "PART_ReplaceAllButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "PART_ReplaceNextButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "PART_ReplaceWithTextBox", Type = typeof(TextBox))]
[TemplatePart(Name = "PART_SearchScopeComboBox", Type = typeof(ComboBox))]
[TemplatePart(Name = "PART_SearchUpButton", Type = typeof(ButtonBase))]
[TemplatePart(Name = "PART_UseRegularExpressionsButton", Type = typeof(ButtonBase))]
public abstract class SearchViewBase : Control
Inheritance:
object Visual UIElement FrameworkElement Control object
Derived:
EditorSearchView SearchOverlayPane

Constructors

SearchViewBase()

Initializes an instance of the class.

protected SearchViewBase()

Properties

AnimationDuration

The Duration of the expander animations.

public Duration AnimationDuration { get; set; }

Property Value

Duration:

The default value is 100 milliseconds.

ButtonStyle

The Style to apply to buttons.

public Style? ButtonStyle { get; set; }

Property Value

Style

CanToggleReplace

Indicates whether replace UI can be toggled visible by the end user.

public bool CanToggleReplace { get; set; }

Property Value

bool:

true if replace UI can be toggled visible by the end user; otherwise, false. The default value is true.

FindAllCommand

The ICommand that performs a find all operation.

public ICommand FindAllCommand { get; }

Property Value

ICommand

FindNextCommand

The ICommand that performs a find next operation.

public ICommand FindNextCommand { get; }

Property Value

ICommand

FindWhatTextBox

The TextBox in the template.

protected TextBox? FindWhatTextBox { get; }

Property Value

TextBox

HasNoSearchResults

Indicates whether there are no search results for the current find text.

public bool HasNoSearchResults { get; set; }

Property Value

bool:

true if there are no search results for the current find text; otherwise, false. The default value is false.

Remarks

When true, some search UI may show an indicator that there is no search match.

IsFindAllButtonVisible

Indicates whether the find all button is visible.

public bool IsFindAllButtonVisible { get; set; }

Property Value

bool:

true if the find all button is visible; otherwise, false. The default value is false.

IsOptionsPanelExpanded

Indicates whether the options panel is currently visible.

public bool IsOptionsPanelExpanded { get; set; }

Property Value

bool:

true if the options panel is currently visible; otherwise, false. The default value is false.

IsReplaceVisible

Indicates whether replace UI is currently visible.

public bool IsReplaceVisible { get; set; }

Property Value

bool:

true if replace UI is currently visible; otherwise, false. The default value is false.

ReplaceAllCommand

The ICommand that performs a replace all operation.

public ICommand ReplaceAllCommand { get; }

Property Value

ICommand

ReplaceNextCommand

The ICommand that performs a replace next operation.

public ICommand ReplaceNextCommand { get; }

Property Value

ICommand

ReplaceWithTextBox

The TextBox in the template.

protected TextBox? ReplaceWithTextBox { get; }

Property Value

TextBox

SearchOptions

The IEditorSearchOptions to use when searching within the editor with the search overlay pane.

public IEditorSearchOptions? SearchOptions { get; set; }

Property Value

IEditorSearchOptions

Remarks

This property defaults to using the static Default property value.

SearchPatternProviderFactory

The ISearchPatternProviderFactory that creates the collection of available search pattern providers.

public ISearchPatternProviderFactory SearchPatternProviderFactory { get; set; }

Property Value

ISearchPatternProviderFactory

SearchPatternProviders

The read-only collection of available ISearchPatternProvider objects.

public ReadOnlyCollection<ISearchPatternProvider> SearchPatternProviders { get; }

Property Value

ReadOnlyCollection<ISearchPatternProvider>

Remarks

Change the SearchPatternProviderFactory property value to update this collection.

TargetView

The target IEditorView in which the searching will occur.

public abstract IEditorView? TargetView { get; }

Property Value

IEditorView

ToggleOptionsPanelExpandedCommand

The ICommand that toggles if the options panel is expanded.

public ICommand ToggleOptionsPanelExpandedCommand { get; }

Property Value

ICommand

UseRegularExpressions

Indicates whether to use regular expressions for searching.

public bool UseRegularExpressions { get; set; }

Property Value

bool:

true if regular expressions should be used for searching; otherwise, false. The default value is false.

Remarks

Setting this property will toggle the PatternProvider between RegularExpression and Normal.

Methods

FocusFindWhatTextBox()

Attempts to select all and focus the find-what TextBox.

public bool FocusFindWhatTextBox()

Returns

bool:

true if focus was set; otherwise, false.

OnApplyTemplate()

When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().

public override void OnApplyTemplate()

OnFindSearchOptionsChanged()

Occurs when a search option is changed that may affect find results, such as those used for search result highlighting.

protected virtual void OnFindSearchOptionsChanged()

OnFindWhatTextBoxKeyDown(KeyEventArgs)

Occurs when a key is pressed.

protected virtual void OnFindWhatTextBoxKeyDown(KeyEventArgs e)
Parameter Type Description
e KeyEventArgs

The event data.

OnReplaceWithTextBoxKeyDown(KeyEventArgs)

Occurs when a key is pressed.

protected virtual void OnReplaceWithTextBoxKeyDown(KeyEventArgs e)
Parameter Type Description
e KeyEventArgs

The event data.

OnSearchOptionsChanged()

Occurs when the search options have changed.

protected virtual void OnSearchOptionsChanged()

OnSearchScopeChanged()

Occurs when the search scope has changed.

protected virtual void OnSearchScopeChanged()

OnSearching(SearchOperationType)

Occurs before a search operation is executed by the end user.

protected virtual void OnSearching(SearchOperationType operationType)
Parameter Type Description
operationType SearchOperationType

A SearchOperationType that indicates the search operation type.

RaiseCanExecuteChangedForCommands()

Raise the can-execute changed events for commands.

protected virtual void RaiseCanExecuteChangedForCommands()

Events

SearchOptionsChanged

Occurs when the search options or one of its properties have changed.

public event EventHandler? SearchOptionsChanged

Event Type

EventHandler

Fields

AnimationDurationProperty

Defines the AnimationDuration property.

public static readonly DependencyProperty AnimationDurationProperty

ButtonStyleProperty

Defines the ButtonStyle property.

public static readonly DependencyProperty ButtonStyleProperty

CanToggleReplaceProperty

Defines the CanToggleReplace property.

public static readonly DependencyProperty CanToggleReplaceProperty

HasNoSearchResultsProperty

Defines the HasNoSearchResults property.

public static readonly DependencyProperty HasNoSearchResultsProperty

IsFindAllButtonVisibleProperty

Defines the IsFindAllButtonVisible property.

public static readonly DependencyProperty IsFindAllButtonVisibleProperty

IsOptionsPanelExpandedProperty

Defines the IsOptionsPanelExpanded property.

public static readonly DependencyProperty IsOptionsPanelExpandedProperty

IsReplaceVisibleProperty

Defines the IsReplaceVisible property.

public static readonly DependencyProperty IsReplaceVisibleProperty

SearchOptionsProperty

Defines the SearchOptions property.

public static readonly DependencyProperty SearchOptionsProperty

SearchPatternProviderFactoryProperty

Defines the SearchPatternProviderFactory property.

public static readonly DependencyProperty SearchPatternProviderFactoryProperty

UseRegularExpressionsProperty

Defines the UseRegularExpressions property.

public static readonly DependencyProperty UseRegularExpressionsProperty

Extension Methods