title: WPF Listview - binding a text column to a combobox column selected item
body: <p>I have a Listview:</p>
  
  <pre><code>&lt;ListView ItemsSource="{Binding FieldMap.SourceTargetFieldMap, Mode=Default}"&gt;
      &lt;ListView.View&gt;
          &lt;GridView&gt;
              &lt;GridViewColumn Header="Source Fields" CellTemplate="{StaticResource sourceFieldsTemplate}"/&gt;
              &lt;GridViewColumn Header="Source Values" CellTemplate="{StaticResource =sourceValueTemplate}"&gt;
              &lt;GridViewColumn Header="Target Field" CellTemplate="{StaticResource targetFieldTemplate}"/&gt;
          &lt;/GridView&gt;
      &lt;/ListView.View&gt;
  &lt;/ListView&gt;
  </code></pre>
  
  <p>And I also have cell data templates that these bind to:</p>
  
  <pre><code>&lt;DataTemplate x:Key="sourceFieldsTemplate"&gt;
      &lt;ComboBox x:Name="cbSourceField" SelectedValue="{Binding Path=SourceField, Mode=TwoWay}" DisplayMemberPath="FieldName" ItemsSource="{Binding SourceFieldValues}" Width="120" /&gt;
  &lt;/DataTemplate&gt;
  
  &lt;DataTemplate x:Key="sourceValueTemplate"&gt;
      &lt;TextBox x:Name="tbSourceValue" Margin="5,0,0,0" DataContext="{Binding ElementName=cbSourceField, Path=SelectedItem}" Text="{Binding Path=FieldValue, Mode=TwoWay}" TextWrapping="Wrap"  Width="115" /&gt;
  &lt;/DataTemplate&gt;
  
  &lt;DataTemplate x:Key="targetFieldTemplate"&gt;
      &lt;TextBox x:Name="tbTargetField" Margin="5,0,0,0" Text="{Binding Path=TargetField}" TextWrapping="Wrap" Width="155" IsReadOnly="True"/&gt;
  &lt;/DataTemplate&gt;
  </code></pre>
  
  <p>What I want to do is, bind the Source Value textbox field to the selected item of the SourceFields combobox.  So when an item is selected from the sourcefield combobox, a property from the selectedItem (which is actually a object with two properties - something like fieldname and value) populates the textbox.</p>
  
  <p>Both controls are "hidden" within datatemplates and I am not sure how to populate one from the other??</p>
  
  <p>Any ideas?  Much appreciated!!</p>
  
  <p>Matt</p>