internal void EnableBlur() {
WindowInteropHelper windowHelper = new WindowInteropHelper(this);
AccentPolicy accent = new AccentPolicy {
AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND
};
int accentStructSize = Marshal.SizeOf(accent);
IntPtr accentPtr = Marshal.AllocHGlobal(accentStructSize);
Marshal.StructureToPtr(accent, accentPtr, false);
WindowCompositionAttributeData data = new WindowCompositionAttributeData {
Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY,
SizeOfData = accentStructSize,
Data = accentPtr
};
SetWindowCompositionAttribute(windowHelper.Handle, ref data);
Marshal.FreeHGlobal(accentPtr);
}