Drarig29
Drarig29

Reputation: 2245

Add DropShadowEffect to UIElement.Effect with x:Key

What I want to do is quite simple, but I cannot find how to do it.

I have a DropShadowEffect in a ResourceDictionary which has a key:

<DropShadowEffect x:Key="myDropShadow" BlurRadius="8" ShadowDepth="1.5" Direction="270" Color="Black" Opacity=".42" RenderingBias="Performance" />

And I'd like to add it to an Image Effect by referring to its key...

<Image>
    <Image.Effect>
        <DropShadowEffect /> <!-- Here refer to myDropShadow -->
    </Image.Effect>
</Image> 

Upvotes: 0

Views: 63

Answers (1)

Richard Deeming
Richard Deeming

Reputation: 31248

You should be able to use the StaticResource markup extension for this:

<Image Effect="{StaticResource myDropShadow}" ... />

Upvotes: 2

Related Questions