Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wpf window entirely black

Tags:

window

wpf

I sell a WPF application, on one customer machine (out of several hundreds) the entire application window is black, anyone know what's going on?

The machine is running Windows XP with .net 3.5SP1, the graphic adapter is GeForce 6200 with two monitors (disabling one monitor doesn't solve the problem).

Setting "Compatibility settings" to "256 colors" solves the problem (but it's not a viable solution, I need more colors for the app to look good).

The application is yaTimer ( http://www.nbdtech.com/yaTimer/ ), it has custom window chrome based on the techniques described in this post http://blogs.msdn.com/wpfsdk/archive/2008/09/08/custom-window-chrome-in-wpf.aspx in the "Office 2007 without Aero" section.

If anyone can give me a clue as to what's going on I'll be very thankful.

Thanks.

like image 446
Nir Avatar asked Aug 11 '09 19:08

Nir


2 Answers

We (www.novamind.com) had multiple customers in the past having similar issues where the application wouldn't draw correctly or not at all. Reasons were:

  • graphic driver is not up-to-date.
  • Windows theme is corrupt. Changing the Windows theme to something different and back again, solved the issue.
  • Windows is running in a virtual machine. Most virtual machines have a experimental hardware acceleration feature which often does not properly support WPF applications. - Turning off the hardware acceleration solves the problem.

This can also help:

  • Re-install the .NET framework - sometimes the installation is corrupt.
  • Make sure that all the recent Windows Updates are installed.

Hope this helps. Good luck.

like image 68
Patrick Klug Avatar answered Nov 04 '22 10:11

Patrick Klug


I have this issue only with the GlassFrame enabled in the window chome.

Try setting GlassFraneThickness to 0 and your window will render again. You will lose the Glass frame though, but better than a black app.

<shell:WindowChrome.WindowChrome>
    <shell:WindowChrome CaptionHeight="32" GlassFrameThickness="0" ResizeBorderThickness="5" CornerRadius="0" />
</shell:WindowChrome.WindowChrome>

Maybe you can also try to force the window to repaint. Im my case the window content showed when i moved the window to the other monitor or out of the viewport and in again, so a repaint seems to do the job.

In the Microsoft.Windows.Shell Sourcecode there is a function _FixupWindows7Issues() (in the WindowChromeWorker class) which should fix the problem according to it's comment, but obviously doesn't...

like image 2
JCH2k Avatar answered Nov 04 '22 12:11

JCH2k