# Customize the Drop Down Items

This article shows how to customize the drop down items appearance and the drop down size.

## ItemTemplate and ItemTemplateSelector

The UI of the items shown in the drop down list can be customized via the **ItemTemplate** and **ItemTemplateSelector** properties of RadAutoSuggestBox.

The **ItemTemplate** allows you to define a DataTemplate with any UIElements, which will be applied for each item from the ItemsSource of RadAutoSuggestBox.

**Example 1: Setting ItemTemplate**

```XAML
<telerik:RadAutoSuggestBox x:Name="radAutoSuggestBox"
							   TextMemberPath="Name">
    <telerik:RadAutoSuggestBox.ItemTemplate>
        <DataTemplate>
            <StackPanel Orientation="Horizontal">
                <Rectangle Fill="OrangeRed" Width="3" Height="12"/>
                <TextBlock Text="{Binding Name}" Margin="3 0 0 0" TextDecorations="Underline" />
            </StackPanel>
        </DataTemplate>
    </telerik:RadAutoSuggestBox.ItemTemplate>
</telerik:RadAutoSuggestBox>
```

> caption Custom ItemTemplate

![WPF RadAutoSuggestBox Custom ItemTemplate](https://www.telerik.com/products/wpf/documentation/assets/6126de2a2ea9a3322c61832905be2ef7/radautosuggestbox-appearance-customize-drop-down-items-0.png)

The **ItemTemplateSelector** allows you to choose a different DataTemplate for each item in the ItemsSource, based on a condition.

**Example 2: Implementing the template selector**

```C#
public class AutoSuggestBoxItemTemplateSelector : DataTemplateSelector
{
    public DataTemplate DefaultTemplate { get; set; }
    public DataTemplate AlternateTemplate { get; set; }

    public override DataTemplate SelectTemplate(object item, DependencyObject container)
    {
        var dataItem = (CountryInfo)item;
        if (dataItem.Name.Equals("Bulgaria"))
        {
            return this.AlternateTemplate;
        }
        return this.DefaultTemplate;
    }
}
```

**Example 3: Setting ItemTemplateSelector**

```XAML
<telerik:RadAutoSuggestBox x:Name="radAutoSuggestBox1" TextMemberPath="Name">
    <telerik:RadAutoSuggestBox.ItemTemplateSelector>
        <local:AutoSuggestBoxItemTemplateSelector>
            <local:AutoSuggestBoxItemTemplateSelector.DefaultTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Name}" FontWeight="Bold" />
                </DataTemplate>
            </local:AutoSuggestBoxItemTemplateSelector.DefaultTemplate>
            <local:AutoSuggestBoxItemTemplateSelector.AlternateTemplate>
                <DataTemplate>
                    <Border Background="#15D7FF" Padding="4">
                        <TextBlock Text="{Binding Name}" Foreground="White" />
                    </Border>
                </DataTemplate>
            </local:AutoSuggestBoxItemTemplateSelector.AlternateTemplate>
        </local:AutoSuggestBoxItemTemplateSelector>
    </telerik:RadAutoSuggestBox.ItemTemplateSelector>
</telerik:RadAutoSuggestBox>
```

> caption Custom ItemTemplateSelector

![WPF RadAutoSuggestBox Custom ItemTemplateSelector](https://www.telerik.com/products/wpf/documentation/assets/3f86e79ada9bf8f19c7034c44fec0384/radautosuggestbox-appearance-customize-drop-down-items-1.png)

The following example shows how to setup a basic RadAutoSuggestBox in order to test the ItemTemplate features.

**Example 4: Creating data model for the items**

```C#
public static class CountryDataProvider
{
    public static List<CountryInfo> Countries { get; set; }

    static CountryDataProvider()
    {
        Countries = new List<CountryInfo>();
        var cultures = CultureInfo.GetCultures(CultureTypes.SpecificCultures);
        foreach (CultureInfo culture in cultures)
        {
            var regionInfo = new RegionInfo(culture.LCID);
            if (!Countries.Any(x => x.Name.Equals(regionInfo.EnglishName)))
            {
                Countries.Add(new CountryInfo() { Name = regionInfo.EnglishName });
            }
        }
    }
}

public class CountryInfo
{
    public string Name { get; set; }
}
```

**Example 5: Populating the control with data**

```C#
public GettingStarted()
{
    InitializeComponent();
    this.radAutoSuggestBox.ItemsSource = CountryDataProvider.Countries;
}
```

## Drop Down Settings

The RadAutoSuggestBox control provides few properties to change the drop down default sizes - **MaxDropDownHeight**, **MaxDropDownWidth** and **MinDropDownWidth**.

**Example 6: Setting drop down sizes**

```XAML
<telerik:RadAutoSuggestBox MaxDropDownHeight="150" MaxDropDownWidth="100"/>
```

> caption Custom drop down sizes

![WPF RadAutoSuggestBox Custom drop down sizes](https://www.telerik.com/products/wpf/documentation/assets/9dbb29df89c4d4e27a3d8f5b94d18b43/radautosuggestbox-appearance-customize-drop-down-items-2.png)

Additionally, you can manually open or close the drop down via the **IsDropDownOpen** property of RadAutoSuggestBox.

## See Also

* [Getting Started](https://www.telerik.com/products/wpf/documentation/controls/radautosuggestbox/getting-started)
* [Visual Structure](https://www.telerik.com/products/wpf/documentation/controls/radautosuggestbox/visual-structure)
* [Events](https://www.telerik.com/products/wpf/documentation/controls/radautosuggestbox/events)
