maui-405236-utility-controls-switch-caption.md
The DXSwitch control can display a caption near the switch. Use the Content property to specify the caption.
You can enable the AllowContentTap property to change the DXSwitch state when a user taps the caption.
The following example specifies a caption and changes its color in different states:
<ContentPage ...
xmlns:dx="http://schemas.devexpress.com/maui">
<dx:DXSwitch ...
Content="Airplane mode"
AllowContentTap="True"
SwitchIndent="15"
TextColor="Green"
CheckedTextColor="Purple"
DisabledTextColor="Gray"
DisabledCheckedTextColor="Red" />
</ContentPage>
Use the following properties to specify the caption and change its color in different states:
ContentGets or sets the caption of the DXSwitch. This is a bindable property.AllowContentTapGets or sets whether to toggle the DXSwitch when a user taps its caption. This is a bindable property.SwitchIndentGets or sets the gap between the caption and the track within the DXSwitch. This is a bindable property.TextColorGets or sets the caption color of the DXSwitch. This is a bindable property.CheckedTextColorGets or sets the caption color of the DXSwitch in the checked state. This is a bindable property.DisabledTextColorGets or sets the caption color of the DXSwitch in the disabled state. This is a bindable property.DisabledCheckedTextColorGets or sets the caption color of the DXSwitch in disabled and checked states. This is a bindable property.
Use the SwitchPlacement property to change relative track and caption positions as follows: