1

I'm trying to create a simple 'dialog'-type window in WPF. However, for this specific instance, I do not want the client area to have a border, or even a background for that matter. I just want my controls to appear over the background of the window the way they do with a simple MessageBox.

I played with the different values for WindowStyle but they all called out the client area with a color. I also tried simply setting the client's Background to transparent, but that didn't work either just rendering it in black.

Here's a crappy Photoshop job showing what I'm after:

Note: I'm not after the messagebox contents themselves--e.g. the icon, buttons and message, etc.--I'm only asking about how to suppress the client area from appearing in any window. I just happened to use a messagebox as an example as someone linked to it in their answer.

No client area

As you can see (or rather can't) there is no visible demarcation of the client area.

Used to be so simple in WinForms, but WPF has me stumped. Anyone?

Mark A. Donohoe
  • 28,442
  • 25
  • 137
  • 286
  • Getting warmer... http://archive.msdn.microsoft.com/WPFShell – Mark A. Donohoe Aug 04 '11 at 05:06
  • Warmer.... http://www.codeproject.com/KB/WPF/CustomFrames.aspx (Well... sort of. This is for the chrome whereas I want to hide the client area, but it's giving me some ideas...) – Mark A. Donohoe Aug 04 '11 at 05:06
  • Is "typical old window messagebox style for a WPF dialog" is what you are after? http://stackoverflow.com/questions/5289328/wpf-messagebox-window-style .. does this help? – WPF-it Aug 04 '11 at 06:12
  • But that still clearly shows the client area! You have the gray border, then you have the white/light gray client area. What I'm looking for if you use that example, is *just* the gray 'frame' covering the entire area... no white or light gray. Just the dark. I've added a screenshot above of what I mean. – Mark A. Donohoe Aug 04 '11 at 06:54
  • Look at extending the glass into the client area [Extend Glass Frame Into a WPF Application](http://msdn.microsoft.com/en-us/library/ms748975.aspx) –  Oct 31 '12 at 17:02

1 Answers1

2

I'm not sure what you're after. Do you want only the controls on your dialog to be visible with the dialog's border and background transparent? If so, try these settings on your dialog:

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

If you want your dialog's background color to the Winform System.Control with no border, set your form's Background like this (instead of Transparent):

Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"
Jay Riggs
  • 53,046
  • 9
  • 139
  • 151
  • Nope! Still draws the border around the client area so that isn't what I want. I want the controls to appear if they're directly on the window's background without the client area being discernible at all. – Mark A. Donohoe Aug 04 '11 at 05:00