title: SetBinding for Listbox in WPF
body: <p>How to set DisplayMemberPathProperty and SelectedValuepathProperty for Listbox in codeBehind?</p>
  
  <pre><code>Listbox1.SetBinding(ListBox.ItemsSourceProperty, new Binding { Source = _ItemCollection});
  </code></pre>
  
  <p>The above line of code works fine and i can see the data in the listbox.</p>
  
  <p>But when i try to set the displaymemberpathprop and selectedvaluememberpathprop its not working. I did something like this</p>
  
  <pre><code>Listbox1.SetBinding(ListBox.ItemsSourceProperty, new Binding { Source = _ItemCollection});
  Listbox1.SetBinding(ListBox.DisplayMemberPathProperty, "FirstName") ;
  Listbox1.SetBinding(ListBox.SelectedValuePathProperty, "Id");
  </code></pre>
  
  <p>please help</p>
  
  <p>Thanks 
  Sharath</p>