Reputation: 5449
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
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
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