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
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
Unchecked events in your code-beside. The later approach involves subscribing to the
Unchecked events, as shown:
<toolkit:ToggleSwitch Header="ToggleSwitch" IsChecked="true" Checked="ToggleSwitch_Checked" Unchecked="ToggleSwitch_Unchecked"/> ...