title: WPF WindowChrome: Edges of maximized Window are out of the screen
body: <p>I use WindowChrome to customize a Window. When I maximize the Window, then the edges are out of the screen. I use the following code to fix this:</p>
  
  <pre><code>&lt;Window x:Class="WpfApplication1.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
  
      &lt;WindowChrome.WindowChrome&gt;
          &lt;WindowChrome CaptionHeight="50" CornerRadius="0" GlassFrameThickness="0" NonClientFrameEdges="None" ResizeBorderThickness="5" UseAeroCaptionButtons="False" /&gt;
      &lt;/WindowChrome.WindowChrome&gt;
  
      &lt;Grid&gt;  
          &lt;Grid.Style&gt;
              &lt;Style TargetType="{x:Type Grid}"&gt;
                  &lt;Setter Property="Margin" Value="0" /&gt;
                  &lt;Style.Triggers&gt;
                      &lt;DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=WindowState}" Value="Maximized"&gt;
                          &lt;Setter Property="Margin" Value="{x:Static SystemParameters.WindowResizeBorderThickness}" /&gt;
                      &lt;/DataTrigger&gt;
                  &lt;/Style.Triggers&gt;
              &lt;/Style&gt;
          &lt;/Grid.Style&gt;
          &lt;Border BorderThickness="2" BorderBrush="Blue" Background="Yellow" /&gt;
      &lt;/Grid&gt;
  
  &lt;/Window&gt;
  </code></pre>
  
  <p>My problem: How can I get the correct number of pixels, so that the edges are not out of the screen. </p>
  
  <p>SystemParameters.WindowResizeBorderThickness contains not the correct value.</p>