Skip to content

Instantly share code, notes, and snippets.

@mathieubrun
Created February 3, 2013 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mathieubrun/4702790 to your computer and use it in GitHub Desktop.
Save mathieubrun/4702790 to your computer and use it in GitHub Desktop.
Inherit WPF styles, longer
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel>
<StackPanel.Resources>
<Style TargetType="TextBlock" x:Key="DefaultTextBlock">
<Setter Property="Background" Value="Red" />
</Style>
<Style TargetType="TextBlock"
BasedOn="{StaticResource DefaultTextBlock}">
</Style>
<Style TargetType="TextBlock" x:Key="Custom1">
<Setter Property="Foreground" Value="Blue" />
</Style>
<Style TargetType="TextBlock" x:Key="Custom2"
BasedOn="{StaticResource DefaultTextBlock}">
<Setter Property="Foreground" Value="Blue" />
</Style>
</StackPanel.Resources>
<TextBlock>Defaut</TextBlock>
<TextBlock Style="{StaticResource Custom1}">Custom 1 : background remis par defaut</TextBlock>
<TextBlock Style="{StaticResource Custom2}">Custom 2 : background repris de Default</TextBlock>
</StackPanel>
</Page>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment