16

When I display a WPF window with WindowStyle="None", it looks great when using areo.

However, when I use luna or classic, it displays an ugly gray border about 5 pixels wide.

Of course, if I set ResizeMode="NoResize", this border disappears, but I would like the window to be resizable (ResizeMode="CanResize").

Other non WPF applications (live mail, ie, firefox, etc.) do not display this gray border, but are still resizable.

Is there a way to remove this border while still being resizable?

jsirr13
  • 944
  • 2
  • 12
  • 38
tom greene
  • 5,361
  • 9
  • 39
  • 52

3 Answers3

19

I'm using the WPF Customizable Window's Essential Window. Here's my window declaration (abbreviated):

    <CustomWindow:EssentialWindow 
      xmlns:aero="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
      xmlns:CustomWindow="clr-namespace:CustomWindow;assembly=CustomWindow"
      AllowsTransparency="True" Background="Transparent" 
      ResizeMode="CanResizeWithGrip"
      WindowStyle="None"
      ShowInTaskbar="True" >
live2
  • 3,771
  • 2
  • 37
  • 46
Jon Galloway
  • 52,327
  • 25
  • 125
  • 193
14

Try setting AllowsTransparency to True on the Window.

John Myczek
  • 12,076
  • 4
  • 31
  • 44
  • This for the tip. That's not the answer though as AllowTransparency=true disables resizing. – tom greene Jul 28 '09 at 20:46
  • 1
    Yes, you lose resizing from the window edges, but you can still resize with the grip. You can handle resizing from the wnidow edges yourself, if you are interested I can post the code. – John Myczek Jul 29 '09 at 13:25
  • 2
    @JohnMyczek could you post the code of resizing window when AllowsTransparency is set to True? – Tomas Feb 27 '15 at 16:43
11

I found a better answer. No need to mess around with ResizeMode. No need for interop calls. No need to set AllowsTransparency which can have side effects.

<WindowChrome.WindowChrome>
 <WindowChrome CaptionHeight="0" ResizeBorderThickness="5" />
</WindowChrome.WindowChrome>

I took this answer from this thread: How to create a WPF Window without a border that can be resized via a grip only?

I repost it here for people who land here searching google.

Community
  • 1
  • 1
Jonathan Alfaro
  • 4,013
  • 3
  • 29
  • 32