Una forma fácil y linda de decorar nuestras ventanas , y que ademas quede integrada con Windows, es usar Aero Glass.
Lo que devemos hacer es crear una clase en nuestro proyecto llamada GlassHelper
public class GlassHelper
{
[DllImport("dwmapi.dll", PreserveSig = false)]
Luego creamos una struct así:
public class GlassHelper
{
[DllImport("dwmapi.dll", PreserveSig = false)]
static extern void DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS margins);
[DllImport("dwmapi.dll", PreserveSig = false)]
static extern bool DwmIsCompositionEnabled();
public static bool ExtendGlassFrame(Window window, Thickness margin)
{
if (!DwmIsCompositionEnabled())
return false;
IntPtr hwnd = new WindowInteropHelper(window).Handle;
if (hwnd == IntPtr.Zero)
throw new InvalidOperationException("ERROR");
window.Background = Brushes.Transparent;
HwndSource.FromHwnd(hwnd).CompositionTarget.BackgroundColor = Colors.Transparent;
MARGINS margins = new MARGINS(margin);
DwmExtendFrameIntoClientArea(hwnd, ref margins);
return true;
}
}
struct MARGINS
{
public MARGINS(Thickness t)
{
Left = (int)t.Left;
Right = (int)t.Right;
Top = (int)t.Top;
Bottom = (int)t.Bottom;
}
public int Left;
public int Right;
public int Top;
public int Bottom;
}
Y en nuestra ventana colocamos esto:
protected override void OnSourceInitialized(EventArgs e)
{
base.OnSourceInitialized(e);
protected override void OnSourceInitialized(EventArgs e)
{
base.OnSourceInitialized(e);
GlassHelper.ExtendGlassFrame(this, new Thickness(-1));
}
Listo, ya tenemos nuestra ventana decorada con Aero Glass