title: WPF: can't bind object to listbox
body: <p>Trying to bind a <code>listbox</code> to an object. Code runs without errors but for some reason sample data doesn't appear in <code>listbox</code></p>
  
  <p>XAML: <code>ucDataBindingObject.xaml</code></p>
  
  <pre><code>&lt;UserControl x:Class="TheProject.UserControls.ucDataBindingObject"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
               Name="DataBindingObject"
               Width="Auto"
               Height="Auto"
               mc:Ignorable="d"&gt;
  
      &lt;Grid Width="130"
            Height="240"
            Margin="0"&gt;
  
          &lt;ListBox Name="lbObject"
                   Width="110"
                   Height="80"
                   Margin="10,7,-9.6,0"
                   HorizontalAlignment="Left"
                   VerticalAlignment="Top"
                   DisplayMemberPath="Name"
                   ItemsSource="{Binding ElementName=ucDataBindingObject,
                                         Path=Clients}" /&gt;
  
      &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>C#: <code>ucDataBindingObject.xaml.cs</code></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Windows.Controls;
  namespace TheProject.UserControls
  {
      public partial class ucDataBindingObject : UserControl
      {
  
          public List&lt;Client&gt; Clients { get; set; }
  
  
          public ucDataBindingObject()
          {
              Clients = new List&lt;Client&gt;();
              Clients.Add(new Client(1, "David")); // sample data
              Clients.Add(new Client(2, "Helen"));
              Clients.Add(new Client(3, "Joe"));
  
  
              InitializeComponent();
          }
      }
  </code></pre>
  
  <p>C# <code>Client.cs</code></p>
  
  <pre><code>using System;
  using System.Linq;
  
  namespace TheProject.UserControls
  {
      public class Client
      {
          public int ID { get; set; }
          public string Name { get; set; }
  
          public Client(int id, string name)
          {
              this.ID = id;
              this.Name = name;
          }
      }
  }
  </code></pre>