Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove white strip on top of WPF window with WindowStyle=None?

Tags:

wpf

Is it possible to remove the white strip on top of WPF window with Window Style=None. XAML and Window is shown in the screenshot:

enter image description here

like image 333
Joginder S Nahil Avatar asked Apr 14 '16 18:04

Joginder S Nahil


1 Answers

What you are seeing in white is the re-size border. You can remove that and still make the window resizable by setting ResizeMode="CanResizeWithGrip" AllowsTransparency="True"

If you dont want to resize at all then do this - ResizeMode="NoResize", again you wont see the border but you cant resize.

<Window x:Class="HandsOnSolution.MainWindow"         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"         Title="MainWindow" Height="350" Width="525" Background="Green" WindowStyle="None" ResizeMode="CanResizeWithGrip" AllowsTransparency="True">     <Grid>     </Grid> </Window> 

Edit

Good point by @devuxer, if you are interested in dragging you can add this piece of code to the window mouse down event

<Window MouseLeftButtonDown="Window_MouseLeftButtonDown"/>  //code behind private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) {     DragMove(); } 
like image 111
Carbine Avatar answered Oct 02 '22 16:10

Carbine