# Getting Started with WPF Buttons

This tutorial will walk you through the creation of a sample application that contains Telerik buttons.

## Adding Telerik Assemblies Using NuGet

To use **RadButton** when working with NuGet packages, install the `Telerik.Windows.Controls.for.Wpf.Xaml` package. The [package name may vary](https://www.telerik.com/products/wpf/documentation/installation/manual-setup-guides/nuget/available-packages) slightly based on the Telerik dlls set - [Xaml or NoXaml](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/xaml-vs-noxaml)

Read more about NuGet installation in the [Installing UI for WPF from NuGet Package](https://www.telerik.com/products/wpf/documentation/installation/manual-setup-guides/nuget/nuget-installation) article.

> tip With the 2025 Q1 release, the Telerik UI for WPF has a new licensing mechanism. You can learn more about it [here](https://www.telerik.com/products/wpf/documentation/installation/licensing/installing-license-key).

## Adding Assembly References Manually

If you are not using NuGet packages, you can add a reference to the following assemblies:

* **Telerik.Licensing.Runtime**
* **Telerik.Windows.Controls**

You can find the required assemblies for each control from the suite in the [Controls Dependencies](https://www.telerik.com/products/wpf/documentation/common-information/installation-installing-dependencies-wpf) help article.

## RadButton

Here is an example of a **RadButton** that executes some logic when it is clicked.

**Example 1: Defining a button in XAML**

```XAML
<telerik:RadButton x:Name="radButton" 
	                    HorizontalAlignment="Left"
	                    VerticalAlignment="Top"
	                    Click="radButton_Click"
	                    Content="Click Me!" />
```

**Example 2: Defining a Click event handler**

```C#
private void pathButton_Click(object sender, RoutedEventArgs e)
{
    //implement your logic here.
}
```

```VB.NET
Private Sub pathButton_Click(sender As Object, e As RoutedEventArgs)
    'implement your logic here.'
End Sub
```

![WPF RadButtons Simple Button](https://www.telerik.com/products/wpf/documentation/assets/8c3ae2901333087cdc4fd9a761012239/radbuttons_getting_started_01.png)

## RadPathButton

The greatest advantage of this control is that users can visualize a custom path geometry in the button. Also, the geometry can be positioned relatively to the **Content** of the button. Here is an example of a **RadPathButton** that executes some logic when it is clicked.

**Example 3: Defining a path button in XAML**

```XAML
<StackPanel HorizontalAlignment="Left" 
	            VerticalAlignment="Top"
	            Orientation="Horizontal">
    <StackPanel Margin="0,0,20,0">
        <telerik:RadRadioButton Margin="0,0,0,5" Content="Male" />
        <telerik:RadRadioButton Content="Female" />
    </StackPanel>
    <StackPanel>
        <telerik:RadRadioButton Margin="0,0,0,5" Content="Over 18" />
        <telerik:RadRadioButton Content="Under 18" />
    </StackPanel>
</StackPanel>
```

**Example 4: Defining a Click event handler**

```C#
private void pathButton_Click(object sender, RoutedEventArgs e)
{
    //implement your logic here.
}
```

```VB.NET
Private Sub pathButton_Click(sender As Object, e As RoutedEventArgs)
    'implement your logic here.'
End Sub
```

![Rad Path Button 2](https://www.telerik.com/products/wpf/documentation/assets/918b0961daeb633d1099214d834ca77d/radpathbutton2.png)

## RadDropDownButton

Here is an example of a **RadDropDownButton** that contains a list of actions in its DropDown Content.

**Example 5: Defining a drop down button**

```XAML
<StackPanel HorizontalAlignment="Left" 
	            VerticalAlignment="Top"
	            Orientation="Horizontal">
    <StackPanel Margin="0,0,20,0">
        <telerik:RadRadioButton Margin="0,0,0,5" Content="Male" />
        <telerik:RadRadioButton Content="Female" />
    </StackPanel>
    <StackPanel>
        <telerik:RadRadioButton Margin="0,0,0,5" Content="Over 18" />
        <telerik:RadRadioButton Content="Under 18" />
    </StackPanel>
</StackPanel>
```

![WPF RadButtons Dropdown Button](https://www.telerik.com/products/wpf/documentation/assets/26c95e9e4d1b3fbd2aa3490657f38fba/radbuttons_getting_started_02.png)

## RadRadioButton

Here is an example of several **RadRadioButtons** placed in two groups.

**Example 6: Defining a radio button**

```XAML
<StackPanel HorizontalAlignment="Left" 
	            VerticalAlignment="Top"
	            Orientation="Horizontal">
    <StackPanel Margin="0,0,20,0">
        <telerik:RadRadioButton Margin="0,0,0,5" Content="Male" />
        <telerik:RadRadioButton Content="Female" />
    </StackPanel>
    <StackPanel>
        <telerik:RadRadioButton Margin="0,0,0,5" Content="Over 18" />
        <telerik:RadRadioButton Content="Under 18" />
    </StackPanel>
</StackPanel>
```

![WPF RadButtons Radio Buttons](https://www.telerik.com/products/wpf/documentation/assets/ab2a5204febd49f4a778a2ef8932bfb2/radbuttons_getting_started_03.png)

## RadSplitButton

Here is an example of a **RadSplitButton** definition, where a **ListBox** control is used to display a list of items in the **RadSplitButton** **DropDownContent**. The **Content** of the **RadSplitButton** is bound to the **SelectedItem** of the **ListBox**.

**Example 7: Defining a split button**

```XAML
<telerik:RadSplitButton HorizontalAlignment="Left" 
	                        VerticalAlignment="Top"
	                        Content="{Binding Path=SelectedItem.Content, ElementName=FindActions}">
    <telerik:RadSplitButton.DropDownContent>
        <ListBox x:Name="FindActions" SelectionMode="Single">
            <ListBoxItem Content="Quick Find" IsSelected="True" />
            <ListBoxItem Content="Find in Files" />
            <ListBoxItem Content="Find Symbols" />
        </ListBox>
    </telerik:RadSplitButton.DropDownContent>
</telerik:RadSplitButton>
```

![WPF RadButtons Split Button](https://www.telerik.com/products/wpf/documentation/assets/72d1d26889bece199cdab16fa3a35aab/radbuttons_getting_started_04.png)

## RadToggleButton

Here is an example of a **RadToggleButton** that toggles the "Monthly Newsletter" feature of a form.

**Example 8: Defining a toggle button**

```XAML
<StackPanel HorizontalAlignment="Left" 
	            VerticalAlignment="Top"
	            Orientation="Horizontal">
    <telerik:RadToggleButton Margin="0,0,10,0">
        <telerik:RadToggleButton.Content>
            <Image Source="/Silverlight.Help.RadButtons;component/Demos/Images/newsletter.png" Stretch="None" />
        </telerik:RadToggleButton.Content>
    </telerik:RadToggleButton>
    <TextBlock Text="Send a monthly newsletter" />
</StackPanel>
```

![WPF RadButtons Toggle Button](https://www.telerik.com/products/wpf/documentation/assets/554708b55d91195744fb70bc2fcf0148/radbuttons_getting_started_05.png)

## RadToggleSwitchButton

Here is an example of a **RadToggleSwitchButton** that switches between **ON** and **OFF** state.

**Example 9: Defining a toggle switch button**

```XAML
<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="/Telerik.Windows.Themes.Fluent;component/Themes/System.Windows.xaml"/>
    <ResourceDictionary Source="/Telerik.Windows.Themes.Fluent;component/Themes/Telerik.Windows.Controls.xaml"/>
</ResourceDictionary.MergedDictionaries>
```

![WPF RadButtons Toggle Switch Button](https://www.telerik.com/products/wpf/documentation/assets/84da357742eab6e1fdab7a0c4639cc80/radbuttons_getting_started_06.png)

## RadSpeechToTextButton

The following example shows how to define a `RadSpeechToTextButton`. Read more about the control and its settings in the button's [dedicated help article](https://www.telerik.com/products/wpf/documentation/controls/radbuttons/features/speech-to-text-button).

```XAML
<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="/Telerik.Windows.Themes.Fluent;component/Themes/System.Windows.xaml"/>
    <ResourceDictionary Source="/Telerik.Windows.Themes.Fluent;component/Themes/Telerik.Windows.Controls.xaml"/>
</ResourceDictionary.MergedDictionaries>
```

![WPF RadButtons Toggle Switch Button](https://www.telerik.com/products/wpf/documentation/assets/01659b121d6c9d519ba5e2f558cbf1a4/radbuttons-features-speech-to-text-button-0.png)

## Setting a Theme

The controls from our suite support different themes. You can see how to apply a theme different than the default one in the [Setting a Theme](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/styling-apperance-setting-a-theme-overview) help article.

> important Changing the theme using implicit styles will affect all controls that have styles defined in the merged resource dictionaries. This is applicable only for the controls in the scope in which the resources are merged.

To change the theme, you can follow the steps below:

* Choose between the themes and add reference to the corresponding theme assembly (ex: **Telerik.Windows.Themes.Fluent.dll**). You can see the different themes applied in the **Theming** examples from our [WPF Controls Examples](https://demos.telerik.com/wpf/) application.

* Merge the ResourceDictionaries with the namespace required for the controls that you are using from the theme assembly. For the **RadButton's**, you will need to merge the following resources:

  * **Telerik.Windows.Controls**

**Example 10** demonstrates how to merge the ResourceDictionaries so that they are applied globally for the entire application.

**Example 10: Merge the ResourceDictionaries**

```XAML
<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="/Telerik.Windows.Themes.Fluent;component/Themes/System.Windows.xaml"/>
    <ResourceDictionary Source="/Telerik.Windows.Themes.Fluent;component/Themes/Telerik.Windows.Controls.xaml"/>
</ResourceDictionary.MergedDictionaries>
```

> Alternatively, you can use the theme of the control via the [StyleManager](https://docs.telerik.com/devtools/wpf/styling-and-appearance/stylemanager/common-styling-apperance-setting-theme-wpf).

**Figure 1** shows a **RadButtons** with the **Fluent** theme applied.

> caption RadButtons with the fluent theme

![WPF RadButtons RadButtons with the Fluent theme](https://www.telerik.com/products/wpf/documentation/assets/8816ed5edf3ee4c2d1d0ecd925887fca/radbuttons-setting-theme.png)

## Telerik UI for WPF Learning Resources

* [Telerik UI for WPF Buttons Component](https://www.telerik.com/products/wpf/button.aspx)
* [Getting Started with Telerik UI for WPF Components](https://www.telerik.com/products/wpf/documentation/getting-started/first-steps-nuget)
* [Telerik UI for WPF Installation](https://www.telerik.com/products/wpf/documentation/installation/manual-setup-guides/installation-guide)
* [Telerik UI for WPF and WinForms Integration](https://www.telerik.com/products/wpf/documentation/common-information/winforms-integration/overview)
* [Telerik UI for WPF Visual Studio Templates](https://www.telerik.com/products/wpf/documentation/installation/manual-setup-guides/visual-studio-templates)
* [Setting a Theme with Telerik UI for WPF](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/styling-apperance-setting-a-theme-overview)
* [Telerik UI for WPF Virtual Classroom (Training Courses for Registered Users)](https://learn.telerik.com/learn/course/external/view/elearning/16/telerik-ui-for-wpf)
* [Telerik UI for WPF License Agreement](https://www.telerik.com/purchase/license-agreement/wpf-dlw-s)

## See Also

* [Visual Structure](https://www.telerik.com/products/wpf/documentation/controls/radbuttons/visual-structure)
* [Commands](https://www.telerik.com/products/wpf/documentation/controls/radbuttons/commands)
* [Events](https://www.telerik.com/products/wpf/documentation/controls/radbuttons/events)
