1
我想知道是否有辦法爲效果製作模板,所以我可以將其應用於所有控件。這樣,如果我是效果進行修改,我只需要改變它在一個位置......控制效果模板
比方說,我有:
<Button Content="Foo" Height="50" Width="50" >
<Button.Effect>
<DropShadowEffect BlurRadius="10" Color="Black" Opacity="0.5" ShadowDepth="0"/>
</Button.Effect>
</Button>
我想有(我知道這是不正確):
<UserControl.Resources>
<Effect x:Key="MyEffect">
<DropShadowEffect BlurRadius="10" Color="Black" Opacity="0.5" ShadowDepth="0"/>
</Effect>
</UserControl.Resources>
...
<Button Content="Foo" Height="50" Width="50" Effect="{StaticResource MyEffect}" />
有沒有辦法做這樣的事情?
你嘗試了嗎?發生了什麼? – AnthonyWJones 2010-07-29 15:09:28
''不是有效的元素... –
Gabe
2010-07-29 15:42:24