Skip to content

Instantly share code, notes, and snippets.

@markjulmar
Created July 1, 2014 16:55
Show Gist options
  • Save markjulmar/0831db8f4a5c3d0700f3 to your computer and use it in GitHub Desktop.
Save markjulmar/0831db8f4a5c3d0700f3 to your computer and use it in GitHub Desktop.
Creating a Color in XAML
<?xml version="1.0" encoding="UTF-8" ?>
<ContentPage x:Class="TestXaml.MainPage"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:me="clr-namespace:TestXaml;assembly=TestXaml"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<StackLayout Spacing="10">
<StackLayout.Resources>
<ResourceDictionary>
<Color x:Key="ButtonBkColor">
<x:Arguments>
<x:Double>.95</x:Double>
<x:Double>.73</x:Double>
<x:Double>.4</x:Double>
</x:Arguments>
</Color>
<Color x:Key="ButtonTxtColor">
<x:Arguments>
<x:Double>.4</x:Double> <!-- R/255 -->
<x:Double>.62</x:Double>
<x:Double>.95</x:Double>
</x:Arguments>
</Color>
</ResourceDictionary>
</StackLayout.Resources>
<Button Text="Button #1"
BackgroundColor="{StaticResource ButtonBkColor}"
TextColor="{StaticResource ButtonTxtColor}" />
</StackLayout>
</ContentPage>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment