Kiang Teng
Kiang Teng

Reputation: 1705

Setting a style in WPF as property attribute

This seems like extremely easy question, but I do not know how I will go about doing it.

I know you can set the property of a object by using the following syntax

<Button Style="{StaticResource SomeStyle}"/>

However, is it possible to set the style property using this syntax.

<Button>
        <Button.Style>
            WHAT DO I PUT HERE?
        </Button.Style>
    </Button>

Upvotes: 0

Views: 589

Answers (1)

decyclone
decyclone

Reputation: 30840

Documentation on MSDN for StaticResource shows you how to do that:

<Button>
    <Button.Style>
        <StaticResource ResourceKey="SomeStyle" />
    </Button.Style>
</Button>

Upvotes: 1

Related Questions