Hooch
Hooch

Reputation: 29673

WPF - The same effect on many elements

I have 64 labels with text. How can I apply this effect to all of them except one?

<BlurEffect Radius="8.0" KernelType="Box"/>

Upvotes: 2

Views: 811

Answers (2)

Fredrik Hedblad
Fredrik Hedblad

Reputation: 84657

Try this

<Style TargetType="Label">
    <Setter Property="Effect">
        <Setter.Value>
            <BlurEffect Radius="8.0" KernelType="Box"/>
        </Setter.Value>
    </Setter>
</Style>

Update

For the Label that should't have this effect you can use

<Label Style="{x:Null}" ...>

or any other style that you may use

Upvotes: 6

JanW
JanW

Reputation: 1849

Put a style in your window resources which sets the Blur effect

<Style TargetType="{x:Type Label}">
    <Setter Property="Effect">
        <Setter.Value>
             <BlurEffect Radius="8.0" KernelType="Box"/> 
        </Setter.Value>
     </Setter>
</Style>

Upvotes: 1

Related Questions