# DropDown Resizing

## DropDownSizingMode

**RadDropDownList** supports different sizing modes, based on the **DropDownSizingMode** property of the control.

The **SizingMode** enumeration has the following members:

* **None**: no sizing is allowed.

> caption Figure 1: SizingMode.None

![WinForms RadDropDownList SizingMode None](https://www.telerik.com/products/winforms/documentation/assets/ac6589c74130451a16100d58fd5c400c/dropdown-and-listcontrol-dropdownlist-dropdown-resizing001.png)

### SizingMode.None

```C#
this.radDropDownList1.DropDownSizingMode = SizingMode.None; 
```

```VB.NET
Me.radDropDownList1.DropDownSizingMode = SizingMode.None
```

* **RightBottom**: allows sizing in horizontal direction.

> caption Figure 2: SizingMode.RightBottom

![WinForms RadDropDownList SizingMode RightBottom](https://www.telerik.com/products/winforms/documentation/assets/0dfa0c7f699f9fa3cc6e6a63e4e415c0/dropdown-and-listcontrol-dropdownlist-dropdown-resizing002.png)

### SizingMode.RightBottom

```C#
            this.radDropDownList1.DropDownSizingMode = SizingMode.RightBottom; 
```

```VB.NET
Me.radDropDownList1.DropDownSizingMode = SizingMode.RightBottom
```

* **UpDown**: allows sizing in vertical direction.

> caption Figure 3: SizingMode.UpDown

![WinForms RadDropDownList SizingMode UpDown](https://www.telerik.com/products/winforms/documentation/assets/4c3ed5539a3054dd7bea4ecd250a5788/dropdown-and-listcontrol-dropdownlist-dropdown-resizing003.png)

### SizingMode.UpDown

```C#
            this.radDropDownList1.DropDownSizingMode = SizingMode.UpDown; 
```

```VB.NET
Me.radDropDownList1.DropDownSizingMode = SizingMode.UpDown
```

* **UpDownAndRightBottom**: allows sizing in both directions.

> caption Figure 4: SizingMode.UpDownAndRightBottom

![WinForms RadDropDownList SizingMode UpDownAndRightBottom](https://www.telerik.com/products/winforms/documentation/assets/0855553f3c676c9849ab18e555e7f3b3/dropdown-and-listcontrol-dropdownlist-dropdown-resizing004.png)

### SizingMode.UpDownAndRightBottom

```C#
            this.radDropDownList1.DropDownSizingMode = SizingMode.UpDownAndRightBottom; 
```

```VB.NET
Me.radDropDownList1.DropDownSizingMode = SizingMode.UpDownAndRightBottom
```

## Fixed size

You can specify a fixed height or width of the drop-down by setting the **DropDownHeight** and **DropDownWidth** properties.

> caption Figure 5: DropDownHeight

![WinForms RadDropDownList DropDownHeight](https://www.telerik.com/products/winforms/documentation/assets/2cc8c9a5857312e6b68ff00ffef12f61/dropdown-and-listcontrol-dropdownlist-dropdown-resizing005.png)

### DropDownHeight

```C#
this.radDropDownList1.DropDownListElement.DropDownHeight = 400;
```

```VB.NET
Me.radDropDownList1.DropDownListElement.DropDownHeight = 400
```

> caption Figure 6: DropDownWidth

![WinForms RadDropDownList DropDownWidth](https://www.telerik.com/products/winforms/documentation/assets/3422d28ee49aeffb46fa4992234f5c75/dropdown-and-listcontrol-dropdownlist-dropdown-resizing007.png)

#### DropDownWidth

```C#
            this.radDropDownList1.DropDownListElement.DropDownWidth = 400;
```

```VB.NET
Me.radDropDownList1.DropDownListElement.DropDownWidth = 400
```

You can set the **DropDownMinSize** property in order to specify the exact minimum height and width for the drop-down.

> caption Figure 7: DropDownMinSize

![WinForms RadDropDownList DropDownMinSize](https://www.telerik.com/products/winforms/documentation/assets/6ac18a69166c1625005155e6a32a5cc7/dropdown-and-listcontrol-dropdownlist-dropdown-resizing006.png)

#### DropDownMinSize

```C#
this.radDropDownList1.DropDownMinSize = new Size(400, 400);
```

```VB.NET
Me.radDropDownList1.DropDownMinSize = New Size(400, 400)
```

## Auto size

The following example demonstrates a sample approach how to handle the RadDropDownList.**PopupOpening** event and achieve auto size functionality for the pop up in **RadDropDownList**:

### Auto size drop down

```C#
private void RadDropDownList1_PopupOpening(object sender, CancelEventArgs e)
{
    RadDropDownListElement list = sender as RadDropDownListElement;
    float width = 0;

    for (int x = 0; x < list.Items.Count(); x++)
    {
        width = Math.Max(width, TextRenderer.MeasureText(list.Items[x].Text, list.Font).Width);
    }

    if (list.Items.Count * (list.ItemHeight-1) > list.DropDownHeight)
    {
        width += list.ListElement.VScrollBar.Size.Width;

    }

    list.Popup.Width = (int)width;

}
```

```VB.NET
Private Sub RadDropDownList1_PopupOpening(sender As Object, e As CancelEventArgs)
    Dim list As RadDropDownListElement = TryCast(sender, RadDropDownListElement)
    Dim width As Single = 0

    For x As Integer = 0 To list.Items.Count() - 1
        width = Math.Max(width, TextRenderer.MeasureText(list.Items(x).Text, list.Font).Width)
    Next

    If list.Items.Count * (list.ItemHeight - 1) > list.DropDownHeight Then

        width += list.ListElement.VScrollBar.Size.Width
    End If

    list.Popup.Width = CInt(width)

End Sub
```

| Default pop up size                                                                                                                                                                                            | Auto sized popup                                                                                                                                                                                             |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| ![WinForms RadDropDownList Default Popup Size](https://www.telerik.com/products/winforms/documentation/assets/e51fcc7b3a2ff75488afe8d3ab49929b/dropdown-and-listcontrol-dropdownlist-dropdown-resizing009.png) | ![WinForms RadDropDownList Auto sized Popup](https://www.telerik.com/products/winforms/documentation/assets/66861a61aab1f61ec9600fa281c7068d/dropdown-and-listcontrol-dropdownlist-dropdown-resizing010.png) |

## Displayed items

By default, **RadDropDownList** displays 6 items in the pop-up. In case you need to change this number you can set the **DefaultItemsCountInDropDown** property:

> caption Figure 8: DefaultItemsCountInDropDown

![WinForms RadDropDownList DefaultItemsCountInDropDown](https://www.telerik.com/products/winforms/documentation/assets/72b4147e0cb2650d58d994176ffb8884/dropdown-and-listcontrol-dropdownlist-dropdown-resizing008.png)

### DefaultItemsCountInDropDown

```C#
this.radDropDownList1.DropDownListElement.DefaultItemsCountInDropDown = 3;
```

```VB.NET
Me.radDropDownList1.DropDownListElement.DefaultItemsCountInDropDown = 3
```
