Last active
December 12, 2015 02:58
-
-
Save mathieubrun/4702765 to your computer and use it in GitHub Desktop.
Inherit defaut wpf style
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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"> | |
<Setter Property="Background" Value="Red" /> | |
</Style> | |
<Style TargetType="TextBlock" x:Key="Custom1"> | |
<Setter Property="Foreground" Value="Blue" /> | |
</Style> | |
<Style TargetType="TextBlock" x:Key="Custom2" BasedOn="{StaticResource {x:Type TextBlock}}"> | |
<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