Set control color via resource.
in resource file:
<style TargetType="{x:Name button1}">
<setter Property="ColorBrush" Value="Red"/>
</style>
<Window .... >
<Button Name="Button1" Content="Test Button" />
</Window>
like css in html
<style>
#controlID
{
color:red;
}
</style>
<body>
<input id="button1" type="button" value="test button" />
</body>
Define a Style like this in window.resources
<Window.Resources>
<Style x:Key="btnStyleRed" TargetType="Button">
<Setter Property="Background" Value="Red"/>
</Style>
</Window.Resources>
and use this style only on those button to which you want to apply particular style
<Button x:Name="btnLogin" Style="{StaticResource btnStyleRed}" Content="Login" Width="75" />
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