As seen from the Switch
for Xamarin.Forms
, there is currently no option of specifying the color. Conclusively, you will have to create your own renderer for both iOS
and Android
.
Android
Essentially, what you need to do is to override the OnElementChanged
and OnCheckChanged
events and check for the Checked
Property of the Control
. Afterwards, you can set the ThumbDrawable
of the Control
and execute SetColorFilter
with the color you want to apply. Doing so although requires Android 5.1+. An example is given here.
You could also create utilise the StateListDrawable
and add new ColorDrawables
for the StateChecked
, StateEnabled
and lastly, a default value as well. This is supported for Android 4.1+. An example of using the StateListDrawable
is provided in detail here.
iOS
iOS is somewhat more simple. Simply create your own SwitchRenderer
, override the OnElementChanged
event and set the OnTintColor
and ThumbTintColor
.
I hope this helps.