title: WPF: Binding to ComboBox SelectedItem
body: <p>I have a UserControl with ComboBox that based on XML data:</p>
  
  <pre><code>&lt;Root&gt;
  &lt;Node Background="Yellow" Foreground="Cyan" Image="1.ico" Property="aaaa" Value="28" /&gt;
  &lt;Node Background="SlateBlue" Foreground="Black" Image="2.ico" Property="bbbb" Value="2.5" /&gt;
  &lt;Node Background="Teal" Foreground="Green" Image="3.ico" Property="cccc" Value="4.0" /&gt;
  &lt;Node Background="Yellow" Foreground="Red" Image="4.ico" Property="dddd" Value="0" /&gt;&lt;/Root&gt;
  </code></pre>
  
  <p>Here is the UserControl XAML:</p>
  
  <pre><code>&lt;UserControl x:Class="xxxxxxxx.MyComboBox"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           x:Name="myComboBoxControl"&gt;
  &lt;UserControl.Resources&gt;
      &lt;DataTemplate x:Key="dataTemplateNode"&gt;
          &lt;Grid&gt;
              &lt;Grid.ColumnDefinitions&gt;
                  &lt;ColumnDefinition Width="Auto" MinWidth="20"/&gt;
                  &lt;ColumnDefinition Width="*"/&gt;
                  &lt;ColumnDefinition Width="Auto" MinWidth="20"/&gt;
              &lt;/Grid.ColumnDefinitions&gt;
              &lt;Border Background="{Binding XPath=@Background}" Grid.Column="0"&gt;
                  &lt;Image Source="{Binding XPath=@Image}" 
                         Width="16" 
                         Height="16" 
                         Margin="3" /&gt;
              &lt;/Border&gt;
              &lt;Border Background="{Binding XPath=@Background}" Grid.Column="1"&gt;
                  &lt;TextBlock Foreground="{Binding XPath=@Foreground}" 
                             Margin="3"
                             Text="{Binding XPath=@Property}" /&gt;
              &lt;/Border&gt;
              &lt;Border Background="{Binding XPath=@Background}" Grid.Column="2"&gt;
                  &lt;TextBlock Foreground="{Binding XPath=@Foreground}" 
                             Margin="3" 
                             FontWeight="Bold"
                             Text="{Binding XPath=@Value}" /&gt;
              &lt;/Border&gt;
          &lt;/Grid&gt;
      &lt;/DataTemplate&gt;
  
      &lt;XmlDataProvider x:Key="xmlNodeList" 
                       Source="/data/Combo.xml" 
                       XPath="/Root/Node"/&gt;
  &lt;/UserControl.Resources&gt;
  
  &lt;ComboBox Name="myComboBox" 
            ItemsSource="{Binding Source={StaticResource xmlNodeList}}" 
            ItemTemplate="{StaticResource dataTemplateNode}"
            HorizontalContentAlignment="Stretch" /&gt;&lt;/UserControl&gt;
  </code></pre>
  
  <p>In the MainForm.xaml I have a TextBox that I want to bind to the my UserControl SelectedItem.</p>
  
  <pre><code>&lt;StackPanel Orientation="Horizontal"&gt;
  &lt;local:MyComboBox1 x:Name="comboBoxST" /&gt;
  &lt;TextBox x:Name="textBoxST"/&gt;&lt;/StackPanel&gt;
  </code></pre>
  
  <p>I will glad if you will guid me how to do that.</p>
  
  <p>Thanks in advance!</p>