2016-12-19 27 views
0

我想要做的事很簡單,但我找不到如何去做。將DropShadowEffect添加到UIElement.Effect x:Key

我有一個ResourceDictionary一個DropShadowEffect其中有一個關鍵:

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

而且我想通過參考其鍵將其添加到圖像效果...

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

回答

2

您應該能夠使用StaticResource標記擴展名:

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