# Split Button

`RadSplitButton` is a UI combination of RadButton and RadDropDownButton.

A `RadButton` element represents the ButtonPart, while the `RadDropDownButton` represents the DropDownPart. See the different parts of RadSplitButton in the [Visual Structure](https://www.telerik.com/products/wpf/documentation/controls/radbuttons/visual-structure#radsplitbutton) article.

> RadSplitButton looks very similar to RadDropDownButton. The main difference is that RadSplitButton has two separate parts - a clickable button and a button that opens the drop down. On the other hand, RadDropDownButton combines those two actions into a single button.

The split button control implements the `ICommandSource` interface, which allows you to attach commands to the ButtonPart, that will be executed when the button is clicked. Read more about this in the [Commands](https://www.telerik.com/products/wpf/documentation/controls/radbuttons/commands) article.

## Instantiating RadSplitButton

> In order to use the RadSplitButton class, you will need to add а reference to `Telerik.Windows.Controls.dll`.

You can instantiate `RadSplitButton` both in XAML and code.

**Defining a button in XAML**

```XAML
<telerik:RadSplitButton Content="Click Me!" />
```

**Defining a button in code**

```C#
RadSplitButton radSplitButton = new RadSplitButton() { Content = "Click Me!" };
```

```VB.NET
Dim radSplitButton As New RadSplitButton() With { _
    .Content = "Click Me!" _
}
```

> caption RadSplitButton

![The created split button](https://www.telerik.com/products/wpf/documentation/assets/9675549fd7151e5629f218759006e9ac/radbuttons-features-split-button-0.png)

## Adding DropDown Content

In order to add content to the drop-down area of RadSplitButton, use its `DropDownContent` property.

**Adding ListBox as a drop down content**

```XAML
<telerik:RadSplitButton AutoOpenDelay="0:0:0.0" Content="Click or Choose an Item">
    <telerik:RadSplitButton.DropDownContent>
        <ListBox>
            <ListBoxItem Content="Item 1" />
            <ListBoxItem Content="Item 2" />
            <ListBoxItem Content="Item 3" />
        </ListBox>
    </telerik:RadSplitButton.DropDownContent>
</telerik:RadSplitButton>
```

> tip Additionally, the control provides `DropDownContentTemplate` and `DropDownContentTemplateSelector` properties, that can be used to customize the drop down content in a data binding scenario. Read more about data templates in the [Data Templating Overview](https://msdn.microsoft.com/en-us/library/ms742521\(v=vs.100\).aspx) MSDN article.

> caption RadSplitButton with dropdown content

![RadSplitButton with dropdown content](https://www.telerik.com/products/wpf/documentation/assets/a75dffd8b40e24c54767623f07d60b0c/radbuttons-features-split-button-1.png)

## Toggling the RadSplitButton

The ButtonPart of the split button can behave as a toggle button. To enable this, set the `IsToggle`  property of RadSplitButton to `True`.

**Enable toggle mode**

```XAML
<telerik:RadSplitButton IsToggle="True" />
```

> caption RadSplitButton as a toggle button

![RadSplitButton as toggle button](https://www.telerik.com/products/wpf/documentation/assets/b066dba8f300c01eb681b1c6d404744b/radbuttons-features-split-button-2.png)

## Auto Opening

You can allow the RadSplitButton to automatically display its DropDownContent, when you **mouse over the button**. This behaviour is controlled via the `AutoOpenDelay` property of RadSplitButton. The property specifies the time, after which the drop down content is displayed.

To disable the auto-opening feature of the control, set the `AutoOpenDelay` to `0`.

**Setting the AutoOpenDelay property**

```XAML
<telerik:RadSplitButton AutoOpenDelay="0:0:0.5" />
```

## Customizing the RadSplitButton

You can easily customize RadSplitButton by using the following properties:

* `IsOpen`—Specifies whether the DropDownContent of the button is opened.

* `IsChecked`—Specifies the checked state of the button when its ButtonPart behaves like a toggle button. To make this property work, the `IsToggle` property should be set to `true`.

* `CloseOnEscape`—Specifies whether the drop-down should be closed when the `Esc` key gets pressed. The default value is `True`.

* `ButtonPartStyle`—Allows you to define a `Style` for the ButtonPart of the RadSplitButton. The `TargetType` expected by the Style is `RadButton`.

* `TogglePartStyle`—Allows you to define a `Style` for the ButtonPart of RadSplitButton when it is in toggle button mode. The `TargetType` expected by the Style is `RadToggleButton`.

* `CornerRadius`—Specifies the corner radius of RadSplitButton.

* `ToggleCornerRadius`—Specifies the corner radius of the ButtonPart, when it behaves like a toggle button.

* `IsBackgroundVisible`—Controls the visibility of the background and the border of the RadSplitButton control in normal state.

* `IsButtonPartVisible`—Specifies whether the ButtonPart is visible.

* `DropDownButtonPosition`—Specifies the position of the drop down arrow. The possible values are `Bottom`, `Left`, `Right` (default), `Top`.

* `DropDownIndicatorVisibility`—Specifies whether the drop-down arrow should be visible. The default value is `Visible`.

* `DropDownPlacement`—Specifies where the drop down area should be placed - `Absolute`, `Bottom`, `Center`, `Left`, `Right`, `Top`.

* `DropDownWidth`—Specifies the width of the drop-down area.

* `DropDownHeight`—Specifies the height of the drop-down area.

* `DropDownMaxHeight`—Specifies the maximal height of the drop-down area.

* `DropDownMaxWidth`—Specifies the maximal width of the drop-down area.

* `CloseOnPopupMouseLeftButtonUp`—Specifies whether the drop-down area should be closed when the user clicks on the `DropDownContent` of the control. The closing of the drop-down is executed on the `MouseLeftButtonUp` event of the `Popup` control. The default value is `False`.

**Customizing RadSplitButton**

```XAML
<telerik:RadSplitButton DropDownButtonPosition="Bottom" 
							Content="Click or Choose an Item" 
							DropDownWidth="{Binding ActualWidth, RelativeSource={RelativeSource Self}}">
    <telerik:RadSplitButton.DropDownContent>
        <ListBox>
            <ListBoxItem Content="Item 1" />
            <ListBoxItem Content="Item 2" />
            <ListBoxItem Content="Item 3" />
        </ListBox>
    </telerik:RadSplitButton.DropDownContent>
</telerik:RadSplitButton>
```

> caption Customized RadSplitButton

![Customized RadSplitButton](https://www.telerik.com/products/wpf/documentation/assets/7c4b8f1a6f63776f66fa4e3bb2789cf6/radbuttons-features-split-button-3.png)

## See Also

* [RadSplitButton API Reference](http://www.telerik.com/help/wpf/installation-installing-controls-dependencies-wpf.html)
* [Button](https://www.telerik.com/products/wpf/documentation/controls/radbuttons/features/button)
* [DropDown Button](https://www.telerik.com/products/wpf/documentation/controls/radbuttons/features/dropdown-button)
* [Commands](https://www.telerik.com/products/wpf/documentation/controls/radbuttons/commands)
