RadListBox has full autocomplete support - while the control is focused, you can type certain keys and the listbox will select the relative match for the currently typed text.
The purpose of this tutorial is to show you how to configure the autocomplete feature.
This enumeration property specifies whether the text search will be StartsWith/Contains and/or case sensitive. It provides the following entries:
The TypedText property of RadListBox contains the currently typed text. It is updated as soon as the user types a new key for autocomplete.
In most of the cases you will have a RadListBox populated with a collection of business objects. If your data source is more complex and your data objects are not single values but rather more complicated classes that have multiple properties, you can specify which value you want to use for Autocomplete. To accomplish this you need to configure the TextPath/TextBinding property.
Let's have the RadListBox bound to "Customers" collection as explained in Binding to Object article:
Setting TextPath /TextBinding property will allow to use "Name" property of the Customer object for AutoComplete:
<telerik:RadListBox Width="300" x:Name="radListBox1"
Typing, for example "L" will select the corresponding item:
Note that if you have set DisplayMemberPath to a certain property and you want to use the same property for Autocomplete, you don't need to set TextPath/TextBinding.
Autocomplete always starts from the beginning, regardless of the selection.
Pressing Esc clears the current text for autocomplete.
By default the autocomplete feature of RadListBox is always enabled. In order to disable it, you need to set the RadListBox's IsTextSearchEnabled property to False.
<telerik:RadListBox x:Name="radListBox" IsTextSearchEnabled="False"/>
radListBox.IsTextSearchEnabled = false;
The AutocompleteBehavior 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 1 second.
Example 4: Setting AutocompleteBehavior.AutoCompleteTimeout
Telerik.Windows.Controls.Primitives.AutocompleteBehavior.AutoCompleteTimeout = TimeSpan.FromSeconds(2);
Telerik.Windows.Controls.Primitives.AutocompleteBehavior.AutoCompleteTimeout = TimeSpan.FromSeconds(2)