title: WPF - Bind to selecteditem of listbox between user controls
body: <p>I have two usercontrols, the first with a listbox that is bound to a list of Customers that displays some simple details for each customer.</p>
  
  <p>The second user control I would like to be a more detailed view of whichever customer is selected in the listbox of the first usercontrol.</p>
  
  <p>Is it possible to set up a binding in the second control to bind to the selected item in the first user control?</p>
  
  <p>My List box:</p>
  
  <pre><code>            &lt;ListBox Name="lstCustomer" ItemsSource="{Binding Customers}" &gt;           
                  &lt;ListBox.Resources&gt;
  
                      &lt;DataTemplate DataType="{x:Type MyApplication:Customers}"&gt;
                         &lt;Label Grid.Row="0" Content="{Binding Customer.name}" FontSize="14" FontWeight="Bold" Padding="5" /&gt;                             
                                  &lt;Label Grid.Row="1" Grid.Column="0" Content="{Binding Customer.telephone}" Padding="10,5" /&gt;                 
                              &lt;/Grid&gt;
                          &lt;/Grid&gt;
  
                      &lt;/DataTemplate&gt;
                  &lt;/ListBox.Resources&gt;
              &lt;/ListBox&gt;
  </code></pre>
  
  <p>Detailed view Usercontrol (So Far)</p>
  
  <pre><code> &lt;Grid x:Name="containingGrid" DataContext="{Binding ElementName=lstCustomers, Path=SelectedItem}"&gt;
              &lt;Grid.RowDefinitions&gt;
                  &lt;RowDefinition Height="Auto"/&gt;
                  &lt;RowDefinition Height="Auto"/&gt;
                  &lt;RowDefinition Height="Auto"/&gt;
              &lt;/Grid.RowDefinitions&gt;
              &lt;Grid.ColumnDefinitions&gt;
                  &lt;ColumnDefinition Width="Auto"/&gt;
                  &lt;ColumnDefinition Width="Auto"/&gt;
              &lt;/Grid.ColumnDefinitions&gt;
              &lt;TextBlock Text="{Binding Customer.name}" FontSize="23"/&gt;
          &lt;/Grid&gt;
  </code></pre>
  
  <p>Thanks
  Greg</p>