tom greene
tom greene

Reputation: 5449

How can I remove the border of a WPF window when using luna or classic?

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?

Upvotes: 17

Views: 28821

Answers (3)

Jon Galloway
Jon Galloway

Reputation: 53145

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" >

Upvotes: 19

Jonathan Alfaro
Jonathan Alfaro

Reputation: 4376

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.

Upvotes: 12

John Myczek
John Myczek

Reputation: 12256

Try setting AllowsTransparency to True on the Window.

Upvotes: 14

Related Questions