Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

.net

windows

wpf

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?

like image 969
tom greene Avatar asked Jul 28 '09 17:07

tom greene


People also ask

How do I set the WPF window to the center of the screen?

To open a new window and have it centred on the screen, set the WindowStartupLocation property to CenterScreen. You can do this using the XAML or in code before the window is displayed. Run the program and click the button to see the result.

What is the difference between page and window in WPF?

Window is the root control that must be used to hold/host other controls (e.g. Button) as container. Page is a control which can be hosted in other container controls like NavigationWindow or Frame. Page control has its own goal to serve like other controls (e.g. Button). Page is to create browser like applications.


2 Answers

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" >
like image 91
Jon Galloway Avatar answered Oct 12 '22 13:10

Jon Galloway


Try setting AllowsTransparency to True on the Window.

like image 26
John Myczek Avatar answered Oct 12 '22 13:10

John Myczek