I'm looking for a way to use one color in a ResourceDictionary with a few different keys, for organisation (and copy-paste prevention). What I tried to do but didn't work is almost exactly this:
<?xml version="1.0" encoding="UTF-8"?>
<Application
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Testing.TestApp"
>
<Application.Resources>
<ResourceDictionary>
<Color x:Key="TextColor">#212121</Color>
<Color x:Key="BackgroundColor">#FFFFFF</Color>
<Color x:Key="TextColorInactive">#757575</Color>
<Color x:Key="BackgroundColorInactive">#E0E0E0</Color>
<!-- COLORS - BUTTONS -->
<Color x:Key="TextColorButton">{StaticResource TextColor}</Color>
<Color x:Key="BackgroundColorButton">#F5F5F5</Color>
<Color x:Key="TextColorButtonInactive">{StaticResource TextColorInactive}</Color>
<Color x:Key="BackgroundColorButtonInactive">{StaticResource BackgroundColorInactive}</Color>
<!-- STYLES -->
<Style TargetType="Button">
<Setter Property="BackgroundColor" Value="{StaticResource BackgroundColorButton}" />
<Setter Property="TextColor" Value="{StaticResource TextColorButton}" />
</Style>
<Style x:Key="ButtonInactive" TargetType="Button">
<Setter Property="BackgroundColor" Value="{StaticResource BackgroundColorButtonInactive}" />
<Setter Property="TextColor" Value="{StaticResource TextColorButtonInactive}" />
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>
Is there a way of doing this?
EDIT: I want to do this with as little code behind as possible, preferably just in XAML.