title: How to set default text in the combobox using MVVM
body: <p>I am binding a combobox in the WPF using MVVM pattern. I am able to bind a list of string with the combobox but I don't know how to set a default value in the combobox.
  Well I have a list of names which has "A","B","C" and "D". Now I want that by default "A" should come as default value.</p>
  
  <p>Thanks</p>
  
  <pre><code>&lt;Window x:Class="WpfApplication1.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:ViewModel="clr-namespace:WpfApplication1.ViewModel"
      Title="MainWindow" Height="350" Width="525"&gt;
  &lt;Window.DataContext&gt;
      &lt;ViewModel:NameViewModel&gt;&lt;/ViewModel:NameViewModel&gt;
  &lt;/Window.DataContext&gt;
  &lt;Grid&gt;
      &lt;ComboBox Height="23" Width="120" ItemsSource="{Binding Names}"/&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>public class NameViewModel
  {
     private IList&lt;string&gt; _nameList = new List&lt;string&gt;();
     public IList&lt;string&gt; Names { get; set; }
     public NameViewModel()
     {
         Names = GetAllNames();
     }
  
     private IList&lt;string&gt; GetAllNames()
     {
         IList&lt;string&gt; names = new List&lt;string&gt;();
         names.Add("A");
         names.Add("B");
         names.Add("C");
         names.Add("D");
         return names;
     }
  }
  </code></pre>