This is problem is as simple and unexpected for me. I have a window
<Window x:Class="AppWorkFlowExecutor.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:AppWorkFlowExecutor"
xmlns:fa="http://schemas.fontawesome.io/icons/"
mc:Ignorable="d"
Title="WF Executor" TextBlock.TextAlignment="Center"
FontFamily="Segoe UI" FontSize="14" PreviewMouseDown="Window_PreviewMouseDown"
WindowStyle="None" AllowsTransparency="False" ResizeMode="CanResizeWithGrip" Margin="0"
Closing="Window_Closing" KeyDown="Window_KeyDown" BorderThickness="1" SizeChanged="Window_SizeChanged" >
and I want it to start in the left upper corner. But the result is that it is a little more on the right
in the picture the blue is my background. So I thought that somewhere I have somehow moved it. But when I print the coordinates I get
and that is correct. Apparently I have no problem with the top value
CodePudding user response:
See MSDN:
Set the GlassFrameThickness property to specify the amount that the Windows Aero glass frame extends into the client area of a window. By default, the glass frame will use system values to emulate the look of a standard window. If Windows Aero is enabled, then the standard caption buttons (Maximize, Minimize, Close) are enabled and interactive. To make a custom window that does not have a glass frame, set this thickness to a uniform value of 0. This will disable the standard caption buttons.
Do set glass frame thickness to 0. I have also added Left="0" Top="0"
to your XAML:
<Window x:Class="AppWorkFlowExecutor.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:AppWorkFlowExecutor"
xmlns:fa="http://schemas.fontawesome.io/icons/"
mc:Ignorable="d"
Title="WF Executor" TextBlock.TextAlignment="Center"
FontFamily="Segoe UI" FontSize="14" PreviewMouseDown="Window_PreviewMouseDown"
WindowStyle="None" AllowsTransparency="False" ResizeMode="CanResizeWithGrip" Margin="0" Left="0" Top="0"
Closing="Window_Closing" KeyDown="Window_KeyDown" BorderThickness="1" SizeChanged="Window_SizeChanged" >
<WindowChrome.WindowChrome>
<WindowChrome GlassFrameThickness="0"></WindowChrome>
</WindowChrome.WindowChrome>