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 SearchViewBase class.

protected SearchViewBase()

Properties

AnimationDuration

Gets or sets the Duration of the expander animations.

public Duration AnimationDuration { get; set; }

Property Value

Duration:

The Duration of the expander animations. The default value is 100 milliseconds.

ButtonStyle

Gets or sets the Style to apply to buttons.

public Style ButtonStyle { get; set; }

Property Value

Style:

The Style to apply to buttons.

CanToggleReplace

Gets or sets 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

Gets the ICommand that performs a find all operation.

public ICommand FindAllCommand { get; }

Property Value

ICommand:

The ICommand that performs a find all operation.

FindNextCommand

Gets the ICommand that performs a find next operation.

public ICommand FindNextCommand { get; }

Property Value

ICommand:

The ICommand that performs a find next operation.

FindWhatTextBox

Gets or sets the TextBox in the template.

protected TextBox FindWhatTextBox { get; }

Property Value

TextBox:

The TextBox in the template.

HasNoSearchResults

Gets or sets 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

Gets or sets 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

Gets or sets 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

Gets or sets 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

Gets the ICommand that performs a replace all operation.

public ICommand ReplaceAllCommand { get; }

Property Value

ICommand:

The ICommand that performs a replace all operation.

ReplaceNextCommand

Gets the ICommand that performs a replace next operation.

public ICommand ReplaceNextCommand { get; }

Property Value

ICommand:

The ICommand that performs a replace next operation.

ReplaceWithTextBox

Gets the TextBox in the template.

protected TextBox ReplaceWithTextBox { get; }

Property Value

TextBox:

The TextBox in the template.

SearchOptions

Gets or sets the IEditorSearchOptions to use when searching within the editor with the search overlay pane.

public IEditorSearchOptions SearchOptions { get; set; }

Property Value

IEditorSearchOptions:

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

Remarks

This property defaults to using the static Default property value.

SearchPatternProviderFactory

Gets or sets the ISearchPatternProviderFactory that creates the collection of available search pattern providers.

public ISearchPatternProviderFactory SearchPatternProviderFactory { get; set; }

Property Value

ISearchPatternProviderFactory:

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

SearchPatternProviders

Gets the read-only collection of available ISearchPatternProvider objects.

public ReadOnlyCollection<ISearchPatternProvider> SearchPatternProviders { get; }

Property Value

ReadOnlyCollection<ISearchPatternProvider>:

The read-only collection of available ISearchPatternProvider objects.

Remarks

Change the SearchPatternProviderFactory property value to update this collection.

TargetView

Gets the target IEditorView in which the searching will occur.

public abstract IEditorView TargetView { get; }

Property Value

IEditorView:

The target IEditorView in which the searching will occur.

ToggleOptionsPanelExpandedCommand

Gets the ICommand that performs a replace next operation.

public ICommand ToggleOptionsPanelExpandedCommand { get; }

Property Value

ICommand:

The ICommand that performs a replace next operation.

UseRegularExpressions

Gets or sets 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()

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

A KeyEventArgs that contains the event data.

OnReplaceWithTextBoxKeyDown(KeyEventArgs)

Occurs when a key is pressed.

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

A KeyEventArgs that contains 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

Identifies the AnimationDuration dependency property. This field is read-only.

public static readonly DependencyProperty AnimationDurationProperty

ButtonStyleProperty

Identifies the ButtonStyle dependency property. This field is read-only.

public static readonly DependencyProperty ButtonStyleProperty

CanToggleReplaceProperty

Identifies the CanToggleReplace dependency property. This field is read-only.

public static readonly DependencyProperty CanToggleReplaceProperty

HasNoSearchResultsProperty

Identifies the HasNoSearchResults dependency property. This field is read-only.

public static readonly DependencyProperty HasNoSearchResultsProperty

IsFindAllButtonVisibleProperty

Identifies the IsFindAllButtonVisible dependency property. This field is read-only.

public static readonly DependencyProperty IsFindAllButtonVisibleProperty

IsOptionsPanelExpandedProperty

Identifies the IsOptionsPanelExpanded dependency property. This field is read-only.

public static readonly DependencyProperty IsOptionsPanelExpandedProperty

IsReplaceVisibleProperty

Identifies the IsReplaceVisible dependency property. This field is read-only.

public static readonly DependencyProperty IsReplaceVisibleProperty

SearchOptionsProperty

Identifies the SearchOptions dependency property. This field is read-only.

public static readonly DependencyProperty SearchOptionsProperty

SearchPatternProviderFactoryProperty

Identifies the SearchPatternProviderFactory dependency property. This field is read-only.

public static readonly DependencyProperty SearchPatternProviderFactoryProperty

UseRegularExpressionsProperty

Identifies the UseRegularExpressions dependency property. This field is read-only.

public static readonly DependencyProperty UseRegularExpressionsProperty