Search code examples
wpfexpression-blend

Is it possible to add more than one effect to a Label in Blend?


I'd like to have a label with a blur effect and a drop shadow effect.


Solution

  • If you use the older BitmapEffect, then you can make use of the BitmapEffectGroup:

    <Label Content="Hello">
        <Label.BitmapEffect>
            <BitmapEffectGroup>
                <DropShadowBitmapEffect />
                <BlurBitmapEffect />
            </BitmapEffectGroup>
        </Label.BitmapEffect>
    </Label>
    

    BitmapEffect, however is being depreciated, and UIElement.Effect is the preferred method to add effects. To combine multiple behaviors into a Effect of this type, you will have to create a custom effect that does what you desire. As shown here, which will require more then just editing the elements through blend.

    Also, take a look here: WPF Pixel Shader Effect Library They have some exelent examples and pre-built effects as well as good tutorial on how to create your own.