Using the ToggleSwitch

Like the ToggleButton, ToggleSwitch uses a nullable Boolean value to represent its state. In its On position, its IsChecked property is true. In the Off position, IsChecked is false. If the IsChecked property is null, the ToggleSwitch is displayed using its Off position.

You can use the ToggleSwitch by either binding its IsChecked property to a property in your viewmodel, or by responding to its Checked and Unchecked events in your code-beside. The later approach involves subscribing to the ToggleSwitch.Checked and Unchecked events, as shown:

<toolkit:ToggleSwitch        Header="ToggleSwitch"        IsChecked="true"        Checked="ToggleSwitch_Checked"        Unchecked="ToggleSwitch_Unchecked"/> ...

Get Windows® Phone 8 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.