title: WPF WindowChrome with background - system buttons are hidden
body: <p>I am creating custom WPF Window using <code>WindowChrome</code>. I have my own style defined but title bar presents problem. If I set <code>Background</code> of my main <code>Grid</code> in template to Transparent then the whole window uses system accent colors and <code>Maximize/Minimize/Close</code> buttons are visible.</p>
  
  <p>When I set any other background <code>Maximize/Minimize/Close</code> buttons get covered. I thought I just make my own, but those buttons are still clickable. </p>
  
  <p>Is there any way to either show them or disable completely?</p>
  
  <p>I can set <code>CaptionHeight</code> to 0 and create mi own title bar, but I don't want to reimplement drag and other default features. </p>
  
  <p>My Style is below:</p>
  
  <pre><code>&lt;Window.Style&gt;
          &lt;Style TargetType="{x:Type Window}"&gt;
              &lt;Setter Property="shell:WindowChrome.WindowChrome"&gt;
                  &lt;Setter.Value&gt;
                      &lt;shell:WindowChrome GlassFrameThickness="-1" 
                              ResizeBorderThickness="4"
                              CaptionHeight="36"/&gt;
                  &lt;/Setter.Value&gt;
              &lt;/Setter&gt;
              &lt;Setter Property="Template"&gt;
                  &lt;Setter.Value&gt;
                      &lt;ControlTemplate TargetType="{x:Type local:ConfigurationWindow}" &gt;
                          &lt;Grid&gt;
                              &lt;Rectangle Fill="Blue" VerticalAlignment="Top" Width="{TemplateBinding Width}"
                                         Height="35" &gt;&lt;/Rectangle&gt;
                              &lt;!-- This is the ContentPresenter that displays the window content. --&gt;
                              &lt;Border Margin="0,40,0,5" &gt;
                                  &lt;ContentPresenter Content="{TemplateBinding Content}"/&gt;
                              &lt;/Border&gt;
                              &lt;!--This is the transparent white rectangle that goes behind the window content.--&gt;
                              &lt;Border Margin="1,40,1,5" BorderBrush="Gray" BorderThickness="0,1,0,1" 
                    Grid.ZIndex="-1"&gt;
                                  &lt;Rectangle Fill="White" Opacity="0.5" /&gt;
                              &lt;/Border&gt;
  
                              &lt;!-- Window Title --&gt;
                              &lt;TextBlock VerticalAlignment="Top" TextAlignment="Center" 
                         Padding="0,3,0,8" 
                         Text="{Binding RelativeSource=
                                       {RelativeSource TemplatedParent}, Path=Title}" /&gt;
                          &lt;/Grid&gt;
                      &lt;/ControlTemplate&gt;
                  &lt;/Setter.Value&gt;
              &lt;/Setter&gt;
          &lt;/Style&gt;
      &lt;/Window.Style&gt;
  </code></pre>