Alexandru Circus
Alexandru Circus

Reputation: 5538

Inherit default Button style

I want to inherit and alter the style of the default button but cannot figure out how.

Using:

<Style x:Key="MyBasicButtonStyle" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}"></Style>

does not work, it says the "Type" cannot be used in Windows Store App project....

Upvotes: 1

Views: 143

Answers (1)

Misha Zaslavsky
Misha Zaslavsky

Reputation: 9702

You can do it like this:

<Style x:Key="BaseStyle" TargetType="Button">
    <Setter Property="Background" Value="Yellow" />
    ...
</Style>

<Style x:Key="InheritedStyle" TargetType="Button" BasedOn="{StaticResource BaseStyle}">
    <Setter Property="Foreground" Value="Red" />
    ...
</Style>

Upvotes: 1

Related Questions