title: DataBinding with a layer class
body: <p>When I have a middleman layer class that holds my list of objects, ListBox I use cannot populate the DisplayMembers properly. Without Layer class everything is fine but I need it for my project. Here's a very simplified example;</p>
  
  <p>Passenger</p>
  
  <pre><code>class Passenger
  {
          private string name;
  
          public Passenger(string custName)
          {
              name = custName;
          }
  
          public string Name
          {
              get { return name; }
          }
  }
  </code></pre>
  
  <p>Plane</p>
  
  <pre><code>class Plane
  {
          public List&lt;LayerClass&gt; passengerList;
  
          public Plane()
          {
              // Using this instead of using Passenger, 
              // if Passenger is used there are no problems
              passengerList = new List&lt;LayerClass&gt;(); 
          }
  }
  </code></pre>
  
  <p>Layer Class</p>
  
  <pre><code>class LayerClass
   {
          private Passenger p;
          private int ID;
  
          public Passenger P
          {
              get { return p; }
              set { p = value; }
          }
   }
  </code></pre>
  
  <p>Let's say I populate the plane with three passenger names, then code below;</p>
  
  <pre><code>BindingSource bs = new BindingSource();
  bs.DataSource = plane.passengerList;
  
  aListBox.DataSource = bs;
  aListBox.DisplayMember = "Name";
  </code></pre>
  
  <p>aListBox will display multiple lines of text "<strong><em>DataBinding.TestApp,LayerClass</em></strong>" instead of the names of the passengers.
  If I insert this code, <code>bs.DataMember = "P";</code> or <code>aListBox.DisplayMember = "P.Name";</code>, It will only display the first passenger's name in the ListBox and ignore all other names.</p>
  
  <p>How can I display all passenger names in the ListBox? Without overriding ToString() method of the Passenger class. Could be something simple that I am missing but I am new to DataBinding. This is a Windows Forms application with strict restrictions on what I am allowed to use. No XAML or WPF are allowed.</p>