Trouble with creating WPF window extended on the title area (like Office 2007/2010)
- by Rikker Serg
I want to make WPF window extended on the title area (like Office 2007/2010). I implemented DwmWindow (see DwmTest.zip) where I put required stuff. Commonly, it works fine except one disgusting thing: the window appears as white rectangle (see DwmIssue.png) and after a few second this rectangle disappears and the content of the window is shown (see DwmIssueCorrect.png). This bug is essential only for my window. If I remove this lines it works fine (without it aero will not showed on title):
HwndSource mainWindowSrc = HwndSource.FromHwnd(handle);
if (mainWindowSrc != null) mainWindowSrc.CompositionTarget.BackgroundColor = Colors.Transparent;
NativeMethods.MARGINS margins = new NativeMethods.MARGINS(0, 50, 0, 0);
NativeMethods.DwmExtendFrameIntoClientArea(handle, margins);
How can I eliminate this white rectangle?
(To run a sample DwmTest.zip WinVista/7 with DWM enabled and .NET 4.0 is required. To compile sample you will need Visual Studio 2010)