title: WPF Bind property to another element property by the element's name
body: <p>I have the following xaml:</p>
  
  <pre><code>&lt;Grid KeyboardNavigation.TabNavigation="Local" SnapsToDevicePixels="True"&gt;
      &lt;Grid&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height="Auto"/&gt;
              &lt;RowDefinition Height="*"/&gt;
          &lt;/Grid.RowDefinitions&gt;
          &lt;Border Background="Transparent" BorderThickness="0,0,0,2"  BorderBrush="{StaticResource TabPanelBorderBrush}"&gt;
              &lt;DockPanel LastChildFill="True"&gt;
                  &lt;Button x:Name="LeftButton" Content="3" DockPanel.Dock="Left"   Style="{DynamicResource TabControlButton}"&gt;&lt;/Button&gt;
                  &lt;StackPanel Orientation="Horizontal" DockPanel.Dock="Right"&gt;
                      &lt;Button x:Name="RightButton" Content="4" Style="{DynamicResource TabControlButton}"&gt;&lt;/Button&gt;
                      &lt;Button x:Name="TabItemsList"  Content="L" FontFamily="Segoe UI" Style="{DynamicResource TabControlButton}"&gt;&lt;/Button&gt;
                      &lt;Button x:Name="AddTabItem" Content="+" FontFamily="Segoe UI" Style="{DynamicResource TabControlButton}"&gt;&lt;/Button&gt;
                  &lt;/StackPanel&gt;
                  &lt;ScrollViewer x:Name="ScrollViewer" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Hidden"&gt;
                      &lt;TabPanel x:Name="HeaderPanel" IsItemsHost="True" Panel.ZIndex="1" KeyboardNavigation.TabIndex="1"/&gt;
                  &lt;/ScrollViewer&gt;
              &lt;/DockPanel&gt;
          &lt;/Border&gt;
          &lt;Border Grid.Row="1" Background="{StaticResource TabControlBackground}"/&gt;
          &lt;ContentPresenter Grid.Row="1" Name="PART_SelectedContentHost" ContentSource="SelectedContent"/&gt;
      &lt;/Grid&gt;
      &lt;ListBox x:Name="TabItemsListBox" Width="200" Height="200" HorizontalAlignment="Right" VerticalAlignment="Top" Visibility="Collapsed"&gt;
          &lt;ListBox.Margin&gt;
              &lt;Thickness Left="0" Top="{Binding to TabItemsList height}" Right="0" Bottom="20"/&gt;
          &lt;/ListBox.Margin&gt;
      &lt;/ListBox&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p>I want to bind the <code>ListBox</code>'s top <code>Thickness</code> (TabItemsListBox) to the <code>TabItemsList</code>'s <code>Height</code>.
  How can I do that? tried:</p>
  
  <pre><code>{Binding ElementName=TabItemsList, Path=Height}
  </code></pre>
  
  <p>but my program crushes when I run it</p>