title: Bind List to DataSource
body: <p>I want to be able to bind a list to a listbox datasource and when the list is modified, the listbox's UI automatically updated. (Winforms not ASP).
  Here is a sample :</p>
  
  <pre><code>private List&lt;Foo&gt; fooList = new List&lt;Foo&gt;();
  
      private void Form1_Load(object sender, EventArgs e)
      {
          //Add first Foo in fooList
          Foo foo1 = new Foo("bar1");
          fooList.Add(foo1);
  
          //Bind fooList to the listBox
          listBox1.DataSource = fooList;
          //I can see bar1 in the listbox as expected
      }
  
      private void button1_Click(object sender, EventArgs e)
      {
          //Add anthoter Foo in fooList
          Foo foo2 = new Foo("bar2");
          fooList.Add(foo2);
          //I expect the listBox UI to be updated thanks to INotifyPropertyChanged, but it's not
      }
  
  class Foo : INotifyPropertyChanged
  {
      private string bar_ ;
      public string Bar
      {
          get { return bar_; }
          set 
          { 
              bar_ = value;
              NotifyPropertyChanged("Bar");
          }
      }
  
      public Foo(string bar)
      {
          this.Bar = bar;
      }
  
      public event PropertyChangedEventHandler PropertyChanged;
  
      private void NotifyPropertyChanged(string info)
      {
          if (PropertyChanged != null)
          {
              PropertyChanged(this, new PropertyChangedEventArgs(info));
          }
      }
  
      public override string ToString()
      {
          return bar_;
      }
  }
  </code></pre>
  
  <p>If I replace <code>List&lt;Foo&gt; fooList = new List&lt;Foo&gt;();</code> by <code>BindingList&lt;Foo&gt; fooList = new BindingList&lt;Foo&gt;();</code> then it works. But I don't want to change the original type of foolist. I would like something like this to work : <code>listBox1.DataSource = new BindingList&lt;Foo&gt;(fooList);</code></p>
  
  <p>EDIT : Also I just read here <a href="https://stackoverflow.com/questions/2243950/listt-vs-bindinglistt-advantages-disadvantages">List&lt;T&gt; vs BindingList&lt;T&gt; Advantages/DisAdvantages</a> from Ilia Jerebtsov : "When you set a BindingSource's DataSource to a List&lt;>, it internally creates a BindingList to wrap your list". I think my sample just demonstrates that this is not true : my List&lt;> doesn't seem to be internally wrapped into a BindingList&lt;>.</p>