Text Search Functionality
The RadComboBox control supports rich text search functionality. The TextSearch class and the TextSearchMode property of the RadComboBox can be used in order to regulate how the control behaves when it receives user input.
The purpose of this article is to show the properties of the TextSearch class and the TextSearchMode property. The following sections are included:
TextSearchMode
There are four TextSearchMode types that can work with the RadComboBox:
Contains - only items containing the typed text will be displayed in the drop-down part, case insensitive.
ContainsCaseSensitive - only items containing the typed text will be displayed in the drop-down part, case sensitive.
StartsWith - only items, which text starts with the typed text, will be shown in the drop-down part, case insensitive.
StartsWithCaseSensitive - only items, which text starts with the typed text, will be shown in the drop-down part, case sensitive.
Using TextSearch.TextPath
The TextSearch class is located in the Telerik.Windows.Controls.dll assembly.
You can set the TextSearch.TextPath in order to control which property of each of the RadComboBox's Items will be targetted by the AutoHighlight feature. This is useful when the RadComboBox is bound to a collection of complex bussiness objects. The AutoHighlight feature highlights the first item which fits the user input based on the TextSearchMode and TextSearch.TextPath properties. This property is also useful for the AutoComplete feature.
When the IsEditable property of the RadComboBox is set to False, pressing the same letter more than once results in the next item which fits the TextSearchMode criteria being highlighted.
Using TextSearch.AutoCompleteTimeout
The TextSearch class exposes a static property named AutoCompleteTimeout which allows you to configure the autocomplete timeout. Use this property when you want to set the timeout after which the typed text for the autocomplete is reset. Its default value is 800ms.
Example 1: Setting TextSearch.AutoCompleteTimeout
Telerik.Windows.Controls.TextSearch.AutoCompleteTimeout = TimeSpan.FromSeconds(2);
Telerik.Windows.Controls.TextSearch.AutoCompleteTimeout = TimeSpan.FromSeconds(2)