How to apply multiple effect on same element
How can i set mulitple effect l开发者_如何学Goike(shadow and blur) on same element.
See Using Effects in WPF (Part 2) by Greg Schechter where one can simply nest Decorators
like a Border
and put a different Effect
s on each.
To build on the initial answer and provide an example, just enclose the UIElement
within another new UIElement
(any element for that matter, like a stack panel for example).
Then apply effects for both elements as such:
<StackPanel>
<MediaElement Name="myMedia" Source="Fairytale Dream.wmv" >
<MediaElement.Effect>
<ShaderEffectLibrary:BloomEffect />
</MediaElement.Effect>
</MediaElement>
<StackPanel.Effect>
<ShaderEffectLibrary:ZoomBlurEffect />
</StackPanel.Effect>
</StackPanel>
I think there is no need to combine effects here.
One of these effect will help you for simulating other effects like in case of DropShadow Effect, You could use BlurRadius for Blur Effect and ShadowDepth for shadow..
By using appropriate values you could simulate combination effects...
精彩评论