Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to apply multiple effect on same element

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

like image 925
Firoz Avatar asked Nov 26 '09 06:11

Firoz


2 Answers

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.

like image 143
David Hollinshead Avatar answered Oct 31 '22 04:10

David Hollinshead


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>
like image 22
Ashok Gowtham Avatar answered Oct 31 '22 06:10

Ashok Gowtham