title: WPF/XAML – Binding of WindowChrome.CaptionHeight
body: <p><em>Theme/Generic.xaml</em> of my <strong>WPF Custom Control</strong> <em>MyBaseWindow</em> looks like this:</p>
  
  <pre><code>&lt;Style TargetType="{x:Type MyBaseWindowPath:MyBaseWindow}"&gt;
          …
          &lt;Setter Property="WindowChrome.WindowChrome"&gt;
              &lt;Setter.Value&gt;
                  &lt;WindowChrome CaptionHeight="{Binding ActualHeight, ElementName=HeaderPanel}"
                                GlassFrameThickness="0"
                                CornerRadius="0" /&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
          &lt;Setter Property="Template"&gt;
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate TargetType="{x:Type MyBaseWindowPath:MyBaseWindow}"&gt;
                      …
                      &lt;DockPanel x:Name="HeaderPanel"&gt;
                      …
                      &lt;/DockPanel&gt;
                      …
                  &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>I would like to bind <code>ActualHeight</code> property of <strong>HeaderPanel element</strong> within <code>ControlTemplate</code>. Is it possible?</p>
  
  <hr>
  
  <p>Another solution is use fixed height for <code>WindowChrome.CaptionHeight</code> and <code>HeaderPanel.Height</code>, but I prefer binding to exact height.</p>