如何为文本框添加效果到样式
我试图向样式添加效果以便重用它,但由于某种原因它不起作用......
<Style x:Key="NumericTextBoxStyle" TargetType="{x:Type TextBox}">
<Style.Resources>
<TextBox.Effect x:Key="EffectStyle">
<DropShadowEffect BlurRadius="56"
Direction="392"
Color="#FF872E2E"
RenderingBias="Quality"/>
</TextBox.Effect>
</Style.Resources>
<Setter Property="Height" Value="25"/>
<Setter Property="Width" Value="120"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="TextAlignment" Value="Center"/>
</Style>
但是我如何添加样式部分? (另外我如何声明效果?)
谢谢
I'm trying to add an effect to style in order to reuse it, but from some reason it doesnt work...
<Style x:Key="NumericTextBoxStyle" TargetType="{x:Type TextBox}">
<Style.Resources>
<TextBox.Effect x:Key="EffectStyle">
<DropShadowEffect BlurRadius="56"
Direction="392"
Color="#FF872E2E"
RenderingBias="Quality"/>
</TextBox.Effect>
</Style.Resources>
<Setter Property="Height" Value="25"/>
<Setter Property="Width" Value="120"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="TextAlignment" Value="Center"/>
</Style>
but how do i add the style part ? (also how do i declare for the effect ?)
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试将效果添加为 Setter
或者如果您希望将效果作为样式中的资源,您可以这样做
Try to add the Effect as a Setter instead
Or if you want to have the Effect as a Resource in the Style you can do it like this
您还可以将效果设为全局资源,以便将其与其他样式/控件一起使用:
You can also make your effect a global resource, in order to use it with other styles/controls: