The RadRadioButton control inherits from the RadioButton
control and implements the ICommandSource interface.
Because of the inheritance it has all of the features that the standard RadioButton control has.
The ICommandSource implementation allows you to attach commands to the button, that will be executed when the
RadRadioButton is clicked.
To learn more about the members of the RadRadioButton class you can read
here.
To learn how to use it with commands you should read the Commands topic.
Instantiating RadButton
You can instantiate your RadRadioButton in both XAML and code. Here is an example:
Note |
|---|
The RadRadioButton control is located in the Telerik.Windows.Controls.dll
and in order to use it 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" |
CopyXAML
<telerik:RadRadioButton Content="Radio Item" />
CopyC#
RadRadioButton radRadioButton = new RadRadioButton(){Content = "Radio Item"};
CopyVB.NET
Dim radRadioButton As New RadRadioButton()With {.Content = "Radio Item"}
Handling the Button Checked Event
To execute some logic when the RadRadioButton gets checked, you have to handle the Checked event:
Tip |
|---|
|
As any other button the RadRadioButton exposes a Click event as well.
|
Here is an example of handling the Checked event of a button.
CopyXAML
<telerik:RadRadioButton Content="Radio Item" Checked="RadRadioButton_Checked" />
CopyC#
private void RadRadioButton_Checked( object sender, RoutedEventArgs e )
{
}
CopyVB.NET
Private Sub RadRadioButton_Checked(sender As Object, e As RoutedEventArgs)
End Sub
Grouping RadRadioButtons
By grouping the RadRadioButtons the user will be allowed to check only one button in the group. In order to group several RadRadioButtons you just have to place them in the same layout panel. Here is an example:
CopyXAML
<StackPanel>
<telerik:RadRadioButton Content="Item 1.1" />
<telerik:RadRadioButton Content="Item 1.2" />
</StackPanel>
<StackPanel>
<telerik:RadRadioButton Content="Item 2.1" />
<telerik:RadRadioButton Content="Item 2.2" />
</StackPanel>
The above code creates two groups of RadRadioButtons.
Customizing the RadRadioButton
- IsBackgroundVisible - this property is of type bool and it controls the visibility of the background and the border of the RadRadioButton control in normal state
See Also