<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="WPF" Height="100" Width="300">
<Window.Resources>
<LinearGradientBrush x:Key="NormalBrush" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="White" Offset="0.0"/>
<GradientStop Color="LightGray" Offset="1.0"/>
</LinearGradientBrush>
<LinearGradientBrush x:Key="NormalBorderBrush" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="Gainsboro" Offset="0.0"/>
<GradientStop Color="DarkGray" Offset="1.0"/>
</LinearGradientBrush>
<Style x:Key="MyStyle">
<Setter Property="Control.FontWeight" Value="Bold"/>
<Setter Property="Control.Background" Value="{DynamicResource NormalBrush}"/>
<Setter Property="Control.BorderBrush" Value="{DynamicResource NormalBorderBrush}"/>
<Setter Property="Control.Width" Value="88"/>
<Setter Property="Control.Height" Value="24"/>
<Setter Property="Control.Margin" Value="4"/>
</Style>
</Window.Resources>
<Grid>
<StackPanel Orientation="Horizontal">
<Button Style="{StaticResource MyStyle}"
Content="Named Style"/>
<Button Width="88" Height="24" Margin="4"
Content="Default Style"/>
</StackPanel>
</Grid>
</Window>
|