I want to do something like this:
Resource Dictionary
<Color x:Key="clrPrimary">#5381ac</Color>
<Color x:Key="clrSecondary">#20558a</Color>
<Style TargetType="Grid" x:Key="myGrid">
<Setter Property="Background" Value="{StaticResource clrPrimary"/>
</Style>
Getting Exception:
'#FF5381AC' is not a valid value for property 'Background'.
Having trouble nailing it down, can any one point me in the right direction?
Background
is a Brush
, not a Color
. Your best bet is to define your "Primary" and "Secondary" resources as brushes rather than colours.
Pretty sure you could even base the brushes off your existing colours.
<SolidColorBrush x:Key="PrimaryBrush" Color="{StaticResource clrPrimary}" />
...
<Setter Property="Background" Value="{StaticResource PrimaryBrush}" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With