The RadControls for WPF provide you with a set
of buttons that can be used in different scenarios. You have the following at hand:
- RadButton - a standard-like button that triggers some logic when clicked.
- RadDropDownButton - a button that displays a drop down popup when clicked.
- RadRadioButton - a button that can be checked, but not unchecked via the UI. You can group them in order to allow only one button to be checked at a time.
- RadSplitButton - a button that combines a RadButton and a RadDropDownButton. It has a button part that can be clicked and triggers some logic, and a drop down part, which opens a popup upon clicking.
- RadToggleButton - a standard-like button that can be toggled.
Note |
|---|
RadButtons are located in the Telerik.Windows.Controls.dll
and in order to use them in your project you have to add a reference to the assembly.
You can find more info here.
Then in XAML you have to declare the namespace:
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" |
RadButton
Here is an example of a RadButton that executes some logic when it is clicked.
CopyXAML
<telerik:RadButton x:Name="radButton"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Click="radButton_Click"
Content="Click Me!" />
CopyC#
private void radButton_Click( object sender, RoutedEventArgs e )
{
}
CopyVB.NET
Private Sub radButton_Click(sender As Object, e As RoutedEventArgs)
End Sub
RadDropDownButton
Here is an example of a RadDropDownButton that contains a list of actions in its DropDown Content.
CopyXAML
<telerik:RadDropDownButton HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="Actions">
<telerik:RadDropDownButton.DropDownContent>
<telerik:RadContextMenu>
<telerik:RadMenuItem Header="Add" />
<telerik:RadMenuItem Header="Edit" />
<telerik:RadMenuItem Header="Delete" />
</telerik:RadContextMenu>
</telerik:RadDropDownButton.DropDownContent>
</telerik:RadDropDownButton>
RadRadioButton
Here is an example of several RadRadioButtons placed in two groups.
CopyXAML
<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>
RadSplitButton
Here is an example of a RadSplitButton definition, where a ListBox control is used to display a list of items in the RadSplitButtonDropDownContent. The Content of the RadSplitButton is bound to the SelectedItem of the ListBox.
CopyXAML
<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>
RadToggleButton
Here is an example of a RadToggleButton that toggles the "Monthly Newsletter" feature of a form.
CopyXAML
<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>
See Also