TextSearch.TextPath Attached Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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


See GetTextPath, SetTextPath
See GetTextPath, SetTextPath
<object TextSearch.TextPath="string"/>

Property Value

Type: System.String
The name of the property that contains the text that identifies the item to the user. The default value is an empty string.


Use the TextPath property to associate strings with ItemsControl items for search purposes. For example, if a ListBox contains a collection of Image objects, you can set the TextPath property to “Name”. Then if you set the Name value for one of the images to "dog", the user could select that image by typing “dog” in the ListBox. When the user types enough of the word to distinguish it from other items in the collection, the dog item is selected and displays in the ListBox.


The typed text may not display in the ItemsControl unless the list contains strings or the ItemsControl has a data template associated with it that displays the identifying strings.

In addition to using the TextPath property, the system will try to obtain a string for search purposes in the following order:

The search is always case-insensitive.

Version Information


Supported in: 5


For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.