Telerik UI for Windows Phone by Progress

This topic demonstrates how to use RadToggleSwitch and how to customize it.

Using RadToggleSwitch


The following namespace must be declared in order to use RadToggleSwitch:


Here is how RadToggleSwitch is declared in XAML:


Customizing RadToggleSwitch

RadToggleSwitch inherits from HeaderedContentControl and provides only four unique properties with which it can be customized. These are Command, CommandParameter, ButtonStyle and IsChecked.


The Command property allows users to associate an object that implements the ICommand interface with RadToggleSwitch. This command will then be executed when the toggle switch is switched on or off.


When RadToggleSwitch's Command is to be executed the value of this property will be passed as the command's parameter. If this property is not set, the command parameter will be true if the toggle switch is checked and false if it is unchecked.


Since RadToggleSwitch inherits from HeaderedContentControl it consists of a header part and a button part. The ButtonStyle property allows users to provide a unique style only for the button part if necessary.


The IsChecked property toggles the state of RadToggleSwitch from checked to unchecked and vice versa.