控制效果模板
我想知道是否有一种方法可以制作效果模板,以便我可以将其应用到我的所有控件。这样,如果我要修改效果,我只需在一个位置更改它...
假设我有:
<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}" />
有没有办法做像这样的东西?
I was wondering if there was a way to make a template for an effect so I can apply it to all my controls. That way if i was the effect to be modified, I only have to change it in one location...
Let's say I have:
<Button Content="Foo" Height="50" Width="50" >
<Button.Effect>
<DropShadowEffect BlurRadius="10" Color="Black" Opacity="0.5" ShadowDepth="0"/>
</Button.Effect>
</Button>
I would like to have (I know it's not correct):
<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}" />
Is there a way to do something like this ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需给 DropShadowEffect 一个键即可
Just give a key to DropShadowEffect