Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF: Remove the title/control box

I've just switched over from WinForms to wpf and in WinForms removing the whole title box is very simple, just set the title="" and ControlBox=false.

Now there's many suggestions on how to do this with wpf, all of them using native Win32 calls. Although they do remove the control box, they still leave a thicker border at the top.

I'm certain it's doable using some kind of native call, but how?

like image 469
moevi Avatar asked Nov 04 '10 21:11

moevi


1 Answers

Well, try this

WindowStyle="none"

like this:

<Window x:Class="Test.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow"  WindowStyle="None"
    MinHeight="350" MaxHeight="350" MinWidth="525" MaxWidth="525">
<Grid>

</Grid>
</Window>

Edit:

It looks a little stupid but this way (with Min- and MaxHeight/Width at the same size) you can prevent the window from beeing resized

like image 147
Tokk Avatar answered Sep 29 '22 16:09

Tokk