Reputation: 3152
I'm trying to create style for button in XAML, here is my code:
<Window.Resources>
<Style x:Key="buttons"
TargetType="Control">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush>
<GradientStop Color="GoldenRod"
Offset="0" />
<GradientStop Color="Gold"
Offset="0.10" />
<GradientStop Color="White"
Offset="0.45" />
<GradientStop Color="Gold"
Offset="0.9" />
<GradientStop Color="GoldenRod"
Offset="1" />
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="FontFamily"
Value="Consolas" />
<Setter Property="FontSize"
Value="15" />
<Setter Property="FontWeight"
Value="Bold" />
<Setter Property="BorderThickness"
Value="5" />
<Setter Property="Padding"
Value="0,0" />
</Style>
</Window.Resources>
Everything works fine except BorderThickness property - no matter what value I'm putting there, it doesn't change. I'm wondering what is missing in my code.
Upvotes: 0
Views: 4049
Reputation: 903
Checkout the Button
control default template here.
http://msdn.microsoft.com/en-us/library/ms753328%28v=vs.90%29.aspx
If we see BorderThickness
property has been set to fixed value 1. Hence no changes are reflected.
You need to create a new ControlTemplate
for this purpose.
Upvotes: 5