How can I remove the border of a WPF window when using luna or classic?
Solution 1
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" >
Solution 2
Try setting AllowsTransparency to True on the Window.
Solution 3
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.
tom greene
Updated on January 18, 2022Comments
-
tom greene over 2 years
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?