Hey Hi,
My previous i have dscussed about creating styles,but today we will try how to implement it in our code:
please concentrate on {StaticResource [resourceKey]}
To apply the style Implementstyle to a control we set the Style
property to our style. To get it from the resources we use the{StaticResource Implementstyle }
markup extension.
<Window>
<Window.Resources>
<Style x:Key="Implementstyle"
TargetType="Button">
<Setter
Property="Background" Value="Blue" />
<Setter
Property="FontStyle" Value="Italic" />
<Setter
Property="Padding" Value="11,9" />
<Setter Property="Margin"
Value="8" />
</Style>
</Window.Resources>
<StackPanel
Orientation="Horizontal" VerticalAlignment="Top">
<Button
Style="{StaticResource Implementstyle}">India</Button>
<Button
Style="{StaticResource Implementstyle}">is </Button>
<Button
Style="{StaticResource Implementstyle}">great</Button>
</StackPanel>
</Window>