Skip to main content
TextSearch Class

The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Enables a user to quickly access items in a set by typing prefixes of strings.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)


public sealed class TextSearch : DependencyObject
public ref class TextSearch sealed : DependencyObject
type TextSearch = 
        inherit DependencyObject
Public NotInheritable Class TextSearch
	Inherits DependencyObject

Gets the DependencyObjectType that wraps the CLR type of this instance. (Inherited from DependencyObject.)


Gets the Dispatcher this DispatcherObject is associated with. (Inherited from DispatcherObject.)


Gets a value that indicates whether this instance is currently sealed (read-only).(Inherited from DependencyObject.)

System_CAPS_pubproperty System_CAPS_static Text

Gets or sets the string that identifies an item in a control's collection.

System_CAPS_pubproperty System_CAPS_static TextPath

Gets or sets the name of the items' property that identifies each item in a control's collection.

System_CAPS_pubmethod CheckAccess

Determines whether the calling thread has access to this DispatcherObject.(Inherited from DispatcherObject.)

System_CAPS_pubmethod ClearValue

Clears the local value of a property. The property to be cleared is specified by a DependencyProperty identifier. (Inherited from DependencyObject.)

System_CAPS_pubmethod ClearValue

Clears the local value of a read-only property. The property to be cleared is specified by a DependencyPropertyKey. (Inherited from DependencyObject.)

System_CAPS_pubmethod CoerceValue

Coerces the value of the specified dependency property. This is accomplished by invoking any CoerceValueCallback function specified in property metadata for the dependency property as it exists on the calling DependencyObject.(Inherited from DependencyObject.)

System_CAPS_pubmethod Equals

Determines whether a provided DependencyObject is equivalent to the current DependencyObject.(Inherited from DependencyObject.)

System_CAPS_pubmethod GetHashCode

Gets a hash code for this DependencyObject.(Inherited from DependencyObject.)

System_CAPS_pubmethod GetLocalValueEnumerator

Creates a specialized enumerator for determining which dependency properties have locally set values on this DependencyObject. (Inherited from DependencyObject.)

System_CAPS_pubmethod System_CAPS_static GetText

Returns the string to that identifies the specified item.

System_CAPS_pubmethod System_CAPS_static GetTextPath

Returns the name of the property that identifies an item in the specified element's collection.

System_CAPS_pubmethod GetType

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethod GetValue

Returns the current effective value of a dependency property on this instance of a DependencyObject. (Inherited from DependencyObject.)

System_CAPS_pubmethod InvalidateProperty

Re-evaluates the effective value for the specified dependency property(Inherited from DependencyObject.)

System_CAPS_pubmethod ReadLocalValue

Returns the local value of a dependency property, if it exists. (Inherited from DependencyObject.)

System_CAPS_pubmethod SetCurrentValue

Sets the value of a dependency property without changing its value source. (Inherited from DependencyObject.)

System_CAPS_pubmethod System_CAPS_static SetText

Writes the Text attached property value to the specified element.

System_CAPS_pubmethod System_CAPS_static SetTextPath

Writes the TextPath attached property to the specified element.

System_CAPS_pubmethod SetValue

Sets the local value of a dependency property, specified by its dependency property identifier. (Inherited from DependencyObject.)

System_CAPS_pubmethod SetValue

Sets the local value of a read-only dependency property, specified by the DependencyPropertyKey identifier of the dependency property. (Inherited from DependencyObject.)

System_CAPS_protmethod ShouldSerializeProperty

Returns a value that indicates whether serialization processes should serialize the value for the provided dependency property.(Inherited from DependencyObject.)

System_CAPS_pubmethod ToString

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_pubmethod VerifyAccess

Enforces that the calling thread has access to this DispatcherObject.(Inherited from DispatcherObject.)

System_CAPS_pubfield System_CAPS_static TextPathProperty

Identifies the TextPath attached property.

System_CAPS_pubfield System_CAPS_static TextProperty

Identifies the Text attached property.

This class is used to assign a string to items in a control's collection. Assigning a string to each item in the collection accomplishes two objectives. It specifies the text to display when the item is selected, and it enables the user to select an item by typing the assigned string.

For example, assume that a ComboBox contains a collection of Image objects, one of which is an image of a dog. If you assign the string, "Dog" to that item, the user can select the dog by typing the word in the combo box's text box. As soon as the user types enough of the word to distinguish it from other items in the selection, the image of the dog will be selected. If is set to true on the ComboBox, "Dog" will appear in the text box.

You can specify the text that identifies an item by using the TextSearchTextPath property on a control or by setting the Text property on each item in the control's collection. Setting one of these properties ensures that unexpected text is not displayed. If you set the Text property on a control's collection item, the TextPath property will be ignored. If you set the TextPath property to a value that is not the name of an actual property, TextPath is ignored.

You cannot declare this managed class in XAML, but you can use its static properties to assign values in XAML.

The following examples create ComboBox controls that contain images as items instead of text. Functionally, the examples are the same. The first example sets the TextPath property on the ComboBox and the second example sets the property on each item in the collection.

<ComboBox IsEditable="true" TextSearch.TextPath="Name">
  <Image Name="Cat" Source="data\cat.png"/>
  <Image Name="Dog" Source="data\dog.png"/>
  <Image Name="Fish" Source="data\fish.png"/>
<ComboBox IsEditable="true">
  <Image TextSearch.Text="Cat" Source="data\cat.png"/>
  <Image TextSearch.Text="Dog" Source="data\dog.png"/>
  <Image TextSearch.Text="Fish" Source="data\fish.png"/>
.NET Framework
Available since 3.0
Available since 5.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top