title: How to make a StackPanel Width that of another StackPanel?
body: <p>I have two dockpanels which each have a left StackPanel.</p>
  
  <p>The width of the <strong>bottom</strong> StackPanel is determined by the width of the <strong>text</strong> is in it.</p>
  
  <p>The width of the <strong>top</strong> StackPanel should be the <strong>same</strong> as the width of the <strong>bottom</strong> StackPanel.</p>
  
  <p>I've tried to bind the Width of the top StackPanel to the Width of the bottom StackPanel via ElementName but this doesn't work.</p>
  
  <p><strong>How can I make the top width the same as the bottom width?</strong></p>
  
  <p><a href="https://i.stack.imgur.com/ExvLL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ExvLL.png" alt="alt text"></a>
  </p>
  
  <pre><code>&lt;StackPanel&gt;
      &lt;DockPanel LastChildFill="True" Height="100" &gt;
          &lt;StackPanel Width="{Binding ElementName=LeftMenuText, Path=Width}" 
                      DockPanel.Dock="Left"
                      Background="Yellow"&gt;
              &lt;TextBlock
                  Text="This is some text."/&gt;
          &lt;/StackPanel&gt;
          &lt;StackPanel DockPanel.Dock="Right"
                      Background="Orange"&gt;
          &lt;/StackPanel&gt;
      &lt;/DockPanel&gt;
  
      &lt;DockPanel 
          Height="3"
          Background="Black"&gt;&lt;/DockPanel&gt;
  
      &lt;DockPanel LastChildFill="True" Height="100"&gt;
          &lt;StackPanel Name="LeftMenuWrapper"
                      DockPanel.Dock="Left"
                      Background="Yellow"&gt;
              &lt;TextBlock 
                      Text="This is some text that is longer."/&gt;
          &lt;/StackPanel&gt;
          &lt;StackPanel DockPanel.Dock="Right"
                      Background="Blue"&gt;
          &lt;/StackPanel&gt;
      &lt;/DockPanel&gt;
  &lt;/StackPanel&gt;
  </code></pre>