New to Telerik UI for Silverlight? Download free 30-day trial


The RadButtons provide you with a standard ICommandSource implementation. This means that you can bind your buttons to commands that will be executed when the button is clicked. In order to take advantage of the ICommandSource implementation you can use the following properties:

  • Command - gets the command that will be executed when the command source is invoked.

  • CommandParameter - represents a user defined data value that can be passed to the command when it is executed.

  • CommandTarget - the object on which the command is being executed.

As the RadButtons implement the ICommandSource, you can use them with any command that implements the ICommand interface, for example Telerik DelegateCommand.


Here is an example of a command usage in an MVVM scenario. The command is located in the SampleViewModel class.

Example 1: Defining a command

public class SampleViewModel { public SampleViewModel() { MyCommand = new DelegateCommand(OnCommandExecuted); } public ICommand MyCommand { get; set; }

private void OnCommandExecuted(object obj) 
    MessageBox.Show("MyCommand Executed"); 


Public Class SampleViewModel 
    Public Sub New() 
        MyCommand = New DelegateCommand(AddressOf OnCommandExecuted) 
    End Sub 
    Public Property MyCommand As ICommand 
    Private Sub OnCommandExecuted(ByVal obj As Object) 
        MessageBox.Show("MyCommand Executed") 
    End Sub 
End Class 

Set the SampleViewModel as the DataContext of your UserControl.

Example 2: Setting up the DataContext

public Example() 
    this.DataContext = new SampleViewModel(); 
Public Sub New() 
    Me.DataContext = New SampleViewModel() 
End Sub 

In the XAML provide the bindings for the command and set the command parameter.

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=""

Example 3: Setting up the Command and CommandParameter properties

<telerik:RadButton Content="My Button" 
                   Command="{Binding MyCommand}" 
                   CommandParameter="ParameterValue" /> 

This is a very basic sample, but you can apply this approach to any type of commands that implement the ICommand interface.

See Also

In this article
Not finding the help you need? Improve this article