title: default value in wpf combo box
body: <p>I have a databound combo box that lists Financial Years. The user selects a value from this combo and a value from a 'Client' combo box which then selects that client's report for that financial year for processing by the user.  Although processing a historical document is possible, the default use case is to process a report from the just finished financial year, so I would like to set the Combo box to default to (currently) 2011/2012 which is a string property of the FinancialYear entity.</p>
  
  <p>My xaml:</p>
  
  <pre><code>&lt;ComboBox Canvas.Left="353" 
            Canvas.Top="18" 
            Height="23" 
            Name="cboFinancialYear"
            Width="120" 
            DisplayMemberPath="FinancialYear1" 
            ItemsSource="{Binding}" 
  SelectedValuePath="FinancialYearID" /&gt;;
  </code></pre>
  
  <p>The <code>Window_Loaded</code> method in my code behind:</p>
  
  <pre class="lang-cs prettyprint-override"><code>private void Window_Loaded(object sender, RoutedEventArgs e)
  {
      String thisYear = MainViewModel.GetCurrentFinancialYear();
      lGFinanceEntities = new LGFinanceEntities();
      // Load data into FinancialYears. You can modify this code as needed.
      CollectionViewSource financialYearsViewSource = ((CollectionViewSource)(this.FindResource("financialYearsViewSource")));
      ObjectQuery&lt;FinancialYear&gt; financialYearsQuery = this.GetFinancialYearsQuery(lGFananceEntities);
       financialYearsViewSource.Source = financialYearsQuery.Execute(System.Data.Objects.MergeOption.AppendOnly);
       cboFinancialYear.SelectedItem = thisYear;
  }
  </code></pre>
  
  <p>However this doesn't seem to have any effect, and the selected item in the combo box is the first year in the FinancialYear table.</p>
  
  <p>Can anybody point out what I've done wrong?  I've looked around, but most of the default value implementations in combo boxes seem to be of the 'Select a year' sort as instruction text, whereas I want to actually select a default value.  </p>