Mega Code Archive

 
Categories / VB.Net / WPF
 

Button Based On Style with Target Type

<StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">     <StackPanel.Resources>         <Style TargetType="{x:Type Button}">             <Setter Property="Control.FontSize" Value="24" />             <Setter Property="Control.Foreground" Value="Blue" />             <Setter Property="Control.HorizontalAlignment" Value="Center" />             <Setter Property="Control.Margin" Value="24" />         </Style>         <Style x:Key="hotbtn"                TargetType="{x:Type Button}"                BasedOn="{StaticResource {x:Type Button}}">             <Setter Property="Control.Foreground" Value="Red" />         </Style>     </StackPanel.Resources>     <Button>         Button Number 1     </Button>     <Button Style="{StaticResource hotbtn}">         Button Number 2     </Button> </StackPanel>