views:

2575

answers:

3

I am trying to make the corners of a Window (WPF) rounded and it doesn't work, I tried to make the window itself transparent and add an internal border with rounded corners and it doesn't work.

any ideas?

+2  A: 

you need to set WindowStyle to WindowStyle.None, which will remove the chrome, then you can allow transparency which is an attribute int the Window element, and set the background color to transparent. All of this can be done as attributes to the window tag.

WindowStyle="None"
AllowsTransparency="True"
Background="Transparent"

To make the corners rounded, use a border and set the cornerRadius property

MasterMax1313
A: 

You also need to make a transparent border around your window that's a few pixels wide, or else the edges of your rounded corners get cut off

Paul Betts
+3  A: 

Don't use AllowsTransparency it's slow and buggy, take a look at this link, look for the section "Office 2007 without Aero – Or, you are responsible for everything":

http://blogs.msdn.com/wpfsdk/archive/2008/09/08/custom-window-chrome-in-wpf.aspx

EDIT: some of the techniques in this post are specific to Vista, but the "Office 2007 without Aero" section works on XP (and actually describes what software that is written for Vista has to fall-back to on XP).

Nir
Indeed. That article has some nice examples. I used the technique in it myself several times.
Tom Deleu
My problem is that I need my project to be compatible with XP.
Shimmy
Shimmy, the techniques described in this section are compatible with XP
Nir