title: C# WPF Combobox select first item
body: <p>Goodday,</p>
  
  <p>I want my combobox to select the first item in it. I am using C# and WPF.  I read the data from a DataSet. To fill the combobox:</p>
  
  <pre><code>DataTable sitesTable = clGast.SelectAll().Tables[0];
  cbGastid.ItemsSource = sitesTable.DefaultView;
  </code></pre>
  
  <p>Combo box XAML code:</p>
  
  <pre><code>&lt;ComboBox 
     Name="cbGastid" 
     ItemsSource="{Binding}" 
     DisplayMemberPath="Description" 
     SelectedItem="{Binding Path=id}"
     IsSynchronizedWithCurrentItem="True" /&gt;
  </code></pre>
  
  <p>If I try:</p>
  
  <pre><code>cbGastid.SelectedIndex = 0; 
  </code></pre>
  
  <p>It doesn't work.</p>