Outer Glow Effect and rotation On A Label in WPF

Viewed 7544

I need to create an outer glow effect on a label and make it rotate a little (by about 20 degrees). I'm using the following code, but it's not working the way I want it to:

<Label Height="106" Margin="80,57,36,0" Name="lblHeading" FontSize="35">
    Brian's 15th Birthday Party
    <Label.Effect>
        <DropShadowEffect BlurRadius="100" ShadowDepth="0" Opacity="1" 
                          Color="White"/>
    </Label.Effect>
</Label>

Is it possible to add some text somewhere in the Window and add an outer glow effect and rotation to it? It would be great if anyone can help me out with adding the same effect on a label or any other way to do so without using a label control.

I tried the following, too, but it's not helping. Maybe I don't know how to use it because it's just causing an error:

<OuterGlowBitmapEffect GlowColor="Blue" GlowSize="30" Noise="1" Opacity="0.4" />
3 Answers

This can be done through modification in ControlTemplate.

The key point is using two ContentPresenter to display your text, and attach BlurEffect to one ContentPresenter.

The code:

<Label Content="TestContent" Foreground="White" FontSize="20">
    <Label.Template>
        <ControlTemplate TargetType="Label">
            <Border>
                <Grid>
                    <ContentPresenter TextBlock.Foreground="{TemplateBinding Foreground}"/>
                    <ContentPresenter TextBlock.Foreground="{TemplateBinding Foreground}">
                        <ContentPresenter.Effect>
                            <BlurEffect Radius="5"/>
                        </ContentPresenter.Effect>
                    </ContentPresenter>
                </Grid>
            </Border>
        </ControlTemplate>
    </Label.Template>
</Label>

How it looks

Related