# AutoComplete

**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.

## Using TextSearchMode property

This enumeration property specifies whether the text search will be StartsWith/Contains and/or case sensitive. It provides the following entries:

* Contains

* ContainsCaseSensitive

* StartsWith

* StartsWithCaseSensitive

## Using TypedText property

The TypedText property of RadListBox contains the currently typed text. It is updated as soon as the user types a new key for autocomplete.

## Setting TextPath/TextBinding

In most of the cases you will have a **RadListBox** [populated with a collection of business objects](https://www.telerik.com/products/wpf/documentation/controls/radlistbox/populating-with-data/binding-to-object). 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](https://www.telerik.com/products/wpf/documentation/controls/radlistbox/populating-with-data/binding-to-object) article:

![radlistbox features autocomplete 010](https://www.telerik.com/products/wpf/documentation/assets/4c692e9744145f293d1c1e3e9d2c0dc6/radlistbox_features_autocomplete_010.png)

Setting **TextPath** /**TextBinding** property will allow to use "Name" property of the Customer object for AutoComplete:

**Setting TextPath**

```XAML
<telerik:RadListBox  Width="300" x:Name="radListBox1"
	ItemsSource="{Binding Customers}"
	ItemTemplate="{StaticResource ListBoxCustomTemplate}"
	TextPath="Name" />
```

Typing, for example "L" will select the corresponding item:

![radlistbox features autocomplete 020](https://www.telerik.com/products/wpf/documentation/assets/8a4b11f27c19c22c6ee689451dc21172/radlistbox_features_autocomplete_020.png)

> 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**.

> tip Autocomplete always starts from the beginning, regardless of the selection.

> tip Pressing **Esc** clears the current text for autocomplete.

## Disable 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**.

**Setting IsTextSearchEnabled**

```XAML
<telerik:RadListBox x:Name="radListBox" IsTextSearchEnabled="False"/>
```

**Setting IsTextSearchEnabled**

```C#
radListBox.IsTextSearchEnabled = false;
```

## Using AutocompleteBehavior.AutoCompleteTimeout

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**

```C#
Telerik.Windows.Controls.Primitives.AutocompleteBehavior.AutoCompleteTimeout = TimeSpan.FromSeconds(2);
```

```VB.NET
	Telerik.Windows.Controls.Primitives.AutocompleteBehavior.AutoCompleteTimeout = TimeSpan.FromSeconds(2)
```
