Skip to content

Instantly share code, notes, and snippets.

@ChaseFlorell
Last active May 29, 2020 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChaseFlorell/45db24304f1146b9d6d44ae179a5c687 to your computer and use it in GitHub Desktop.
Save ChaseFlorell/45db24304f1146b9d6d44ae179a5c687 to your computer and use it in GitHub Desktop.
<Style TargetType="Switch">
<Setter Property="OnColor" Value="{DynamicResource SwitchOnColor}" />
<Setter Property="ThumbColor" Value="{DynamicResource SwitchOnThumbColor}" />
<Style.Triggers>
<Trigger TargetType="Switch" Property="IsToggled" Value="False">
<Setter Property="ThumbColor" Value="{DynamicResource SwitchOffThumbColor}" />
</Trigger>
</Style.Triggers>
</Style>
<OnPlatform x:Key="SwitchOnThumbColor" x:TypeArguments="Color">
<On Platform="Android" Value="#fb9e40"/> <!-- AccentColor -->
</OnPlatform>
<OnPlatform x:Key="SwitchOffThumbColor" x:TypeArguments="Color">
<On Platform="Android" Value="#f3f4f4"/> <!-- TextColor -->
</OnPlatform>
<OnPlatform x:Key="SwitchOnColor" x:TypeArguments="Color">
<On Platform="iOS" Value="#fb9e40"/> <!-- AccentColor -->
<On Platform="Android" Value="#dfe0e1"/> <!-- Gray similar to iOS -->
</OnPlatform>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment