title: Difference betwwen Datacontext and ItemSource in WPF
body: <p>Duplicate of : </p>
  
  <p><a href="https://stackoverflow.com/questions/793340/who-has-the-best-answer-for-why-datacontext-and-itemssource-are-not-redundant/793350">Why are DataContext and ItemsSource not redundant?</a></p>
  
  <hr>
  
  <p>In WPF we can assign list of item to ComboBox in 2 ways</p>
  
  <pre><code>//CODE #1
  //WPF
  &lt;ComboBox name="cmbItems" ItemSource={Binding} /&gt;
  
  //C#
  cmbItems.DataContext = someList;
  </code></pre>
  
  <p>another way, directly assign itemsource</p>
  
  <pre><code>//CODE #2
  //WPF
  &lt;ComboBox name="cmbItems" ItemSource={Binding} /&gt;
  //C#
  cmbItems. ItemSource = someList;
  </code></pre>
  
  <p>both serves the purpose, but whats the difference in above snippet? and which is good to use?</p>