Mega Code Archive

 
Categories / VB.Net / WPF
 

Style Inheritance

<Window x:Class="Styles.StyleInheritance"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     Title="StyleInheritance" Height="300" Width="300">   <Window.Resources>     <Style x:Key="BaseStyle">       <Setter Property="Control.FontFamily" Value="Times New Roman" />       <Setter Property="Control.FontSize" Value="18" />       <Setter Property="Control.FontWeight" Value="Bold" />     </Style>     <Style x:Key="EmphasizedBaseStyle" BasedOn="{StaticResource BaseStyle}">       <Setter Property="Control.Foreground" Value="White" />       <Setter Property="Control.Background" Value="DarkBlue" />     </Style>   </Window.Resources>   <StackPanel Margin="5">     <Button Padding="5" Margin="5" Style="{StaticResource BaseStyle}" >Uses BaseStyle</Button>     <Button Padding="5" Margin="5" Style="{StaticResource EmphasizedBaseStyle}">Uses EmphasizedBaseStyle</Button>   </StackPanel> </Window>