Mega Code Archive

 
Categories / VB.Net Tutorial / WPF
 

Extending a Style using the BasedOn attribute

<Page     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">     <Page.Resources>         <Style x:Key="MyStyle">             <Setter Property="Control.Width" Value="200" />         </Style>         <Style x:Key="MyStyle2" BasedOn="{StaticResource MyStyle}">                 <Setter Property="Control.Width" Value="300"/>                 <Setter Property="Control.FontWeight" Value="Bold" />                 <Setter Property="Control.Height" Value="50" />                         </Style>     </Page.Resources>     <StackPanel>         <Button Style="{StaticResource MyStyle}" Content="A"/>         <Button Style="{StaticResource MyStyle2}" Content="B"/>     </StackPanel> </Page>