views:

87

answers:

1

I get an exception thrown at runtime when I set AllowsTransparency="True" I get an exception saying the WindowStyle can not be set to None if AllowsTransparency is set to true. Even if I explicitly say that WindowStyle is set to SingleBorder I get this error. However, if I set WindowStyle to SingleBorder and remove the AllowsTransparency-tag, I get no error, and the top of the window (the icon, name and close, minimize and maximize-buttons) disappears. Anyone knows what can cause this? Or is it just a bug in .Net 4.0 rc?

[Edit]
I've tried this in VS2008 too, and I get the same results. What I wan't to achieve is a simple window where I draw the window myself and leave nothing up to the system, however, things like minimizing and maximizing must still work.

+1  A: 

The error should be the opposite so you're either running into a bug or mis-reading the error message. Any time you have AllowsTransparency="True" the only valid WindowStyle value is None. Any of the others add OS dependent window chrome which can't be forced to have transparency in its client area.

John Bowen