WPF: Remove the title/control box
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
This is an alternative way of doing it.
To remove the Max-/minimize you need to change the ResizeMode
like this
<Window x:Class="MyWpfApplication.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="" Height="350" Width="525" ResizeMode="NoResize">
<Grid>
</Grid>
</Window>
After that you can remove the Close button by adding this ( read more here )
private const int GWL_STYLE = -16;
private const int WS_SYSMENU = 0x80000;
[DllImport("user32.dll", SetLastError = true)]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
public MainWindow()
{
SourceInitialized += Window_SourceInitialized;
}
void Window_SourceInitialized(object sender, EventArgs e)
{
var hwnd = new WindowInteropHelper(this).Handle;
SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);
}