Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make title bar disappear in WPF window?

You need to set the WindowStyle property to None, like I outlined in this answer

<Window ...
    WindowStyle="None"
    WindowState="Maximized"
    WindowStartupLocation="CenterScreen">

You can also set AllowsTransparency="True" and Background="Transparent" if you wish to hide the entire window frame and build your own.

Update based on code added to question

The code you just posted works fine for me. There is no title bar, although there is a Resize border because you specified ResizeMode="CanResize"

You do have some whitespace at the top of your window, but that is because you specified a top Margin for your Slider and TextBox (When you specify a Margin with 4 numbers, it goes Left, Top, Right, Bottom so the 2nd number is your Top Margin)


<Window x:Class="BorderlessWindow.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"
        WindowStyle="None"
        BorderBrush="Black"
        BorderThickness="5"
        AllowsTransparency="True"
        >
    <Grid>
        <TextBlock Text="Title Less Window" HorizontalAlignment="Center" FontSize="15" Margin="10" />
    </Grid>
</Window>

The above code works fine for your question "How to make title bar dissappear in WPF window?"


try to set the caption height to 0

<Window x:Class="BorderlessWindow.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"
    WindowStyle="None"
    WindowStartupLocation="CenterScreen"
    ResizeMode="CanResize">

 //remove the border, glassframe, but keep the ability to resize
<WindowChrome.WindowChrome>
    <WindowChrome GlassFrameThickness="0" CornerRadius="0" CaptionHeight="0"/>
</WindowChrome.WindowChrome>

<Grid>
    <TextBlock Text="Resizeable Window" HorizontalAlignment="Center" FontSize="30"/>  
</Grid>