How to apply multiple effect on same element

2019-04-21 07:49发布

问题:

How can i set mulitple effect like(shadow and blur) on same element.

回答1:

I've just this minute done this. Credit to Greg Schechter for the idea.

You can nest Decorators like a Border and put a different Effect on each. I haven't tried with a large number of Effects yet but so far performance seems good.

Regards David



回答2:

It might be too late, but helps many people visiting for the answer.

Its possible to achieve multiple effects.

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.

Two effects applied!

<StackPanel>
    <MediaElement Name="myMedia" Source="Fairytale Dream.wmv" >
        <MediaElement.Effect>
            <ShaderEffectLibrary:BloomEffect />
        </MediaElement.Effect>
    </MediaElement>
    <StackPanel.Effect>
        <ShaderEffectLibrary:ZoomBlurEffect />
    </StackPanel.Effect>
</StackPanel>


回答3:

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