Skip to content
On this page

Switch

Switches toggle the selection of an item on or off.

  • Use switches (not radio buttons) if the items in a list can be independently controlled.
  • Switches are the best way to let users adjust settings.
  • Make sure the switch’s selection (on or off) is visible at a glance.
  • Two styles: DefaultSwitchStyle and MarkSwitchStyle.

Examples

xml
<md:Switch />
<md:Switch IsSelected="True" />
<md:Switch IsSelected="True" Style="{DynamicResource MarkSwitchStyle}" />

Properties

nametypedefault
IsSelectedboolfalse
ThumbColorColorOutlineColor
IconDatastring
IconColorColorSurfaceContainerHighestColor
BackgroundColorColorSurfaceContainerHighestColor
ShapeShapefull
OutlineColorColorOutlineColor
StateLayerColorColorstyle
CommandICommand
CommandParameterobject

Events

nametype
SelectedChangedEventHandler<CheckedChangedEventArgs>
ClickedEventHandler<TouchEventArgs>
PressedEventHandler<TouchEventArgs>
ReleasedEventHandler<TouchEventArgs>
LongPressedEventHandler<TouchEventArgs>
RightClicked ( desktop only )EventHandler<TouchEventArgs>