开发者

How to apply multiple effect on same element

开发者 https://www.devze.com 2022-12-12 08:11 出处:网络
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 diff

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 Effects 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...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号