How to apply multiple effect on same element

后端 未结 3 1969
终归单人心
终归单人心 2021-01-11 16:04

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

相关标签:
3条回答
  • 2021-01-11 16:52

    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.

    0 讨论(0)
  • 2021-01-11 16:55

    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>
    
    0 讨论(0)
  • 2021-01-11 16:59

    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 讨论(0)
提交回复
热议问题