5

How do I add the Aero white glow behind a control in WPF?
I mean the glow like in a window's caption bar in Vista/7.

Vercas
  • 8,931
  • 15
  • 66
  • 106

2 Answers2

3

This unrelated question seems to have the answer...
Outer bevel effect on text in WPF

I just needed a rectangle behind my text block...

    <Rectangle Height="{Binding ElementName=textBlock1, Path=ActualHeight}" HorizontalAlignment="{Binding ElementName=textBlock1, Path=HorizontalAlignment}" Margin="{Binding ElementName=textBlock1, Path=Margin}" VerticalAlignment="{Binding ElementName=textBlock1, Path=VerticalAlignment}" Width="{Binding ElementName=textBlock1, Path=ActualWidth}" Fill="White" Opacity="0.5">
        <Rectangle.Stroke>
            <SolidColorBrush />
        </Rectangle.Stroke>
        <Rectangle.Effect>
            <BlurEffect Radius="10" KernelType="Gaussian" />
        </Rectangle.Effect>
    </Rectangle>

This is gonna do the trick for any control when you replace all the "textBlock"s in the code!
And it looks exactly the same as the aero glow!

Community
  • 1
  • 1
Vercas
  • 8,931
  • 15
  • 66
  • 106
0

Does this help? The effect can be quite subtle but it does look alright.

I tried messing about with Pixel Shaders in WPF using Shazzam but it was a lot of work to achieve the same effect or better. They use a lot of "under the hood" stuff (such as double-pass shaders) of which the techniques aren't available to the WPF api.

Tom
  • 3,354
  • 1
  • 22
  • 25
  • @Vercas, it explains that using the replacement [DropShadowEffect](http://msdn.microsoft.com/en-us/library/system.windows.media.effects.dropshadoweffect.aspx) class and setting the depth to zero will achieve similar results. – Tom Jun 13 '11 at 14:51
  • Gosh I didn't see that... But my post looks exactly like the glow in Windows. The drop shadow doesn't... – Vercas Jun 13 '11 at 16:37