title: WPF ComboBox binding not working as expected
body: <p>I want my WPF ComboBox's ItemsSource property to be bound to MyListObject's MyList property.  The problem is that when I update the MyList property in code, the WPF ComboBox is not reflecting the update.  I am raising the PropertyChanged event after I perform the update, and I thought WPF was supposed to automatically respond by updating the UI.  Am I missing something?   </p>
  
  <p>Here's the CLR object:</p>
  
  <pre><code>Imports System.ComponentModel
  
  Public Class MyListObject
      Implements INotifyPropertyChanged
  
      Private _mylist As New List(Of String)
  
      Public Sub New()
          _mylist.Add("Joe")
          _mylist.Add("Steve")
      End Sub
  
      Public Property MyList() As List(Of String)
          Get
              Return _mylist
          End Get
          Set(ByVal value As List(Of String))
              _mylist = value
          End Set
      End Property
  
      Public Sub AddName(ByVal name As String)
  
          _mylist.Add(name)
  
          NotifyPropertyChanged("MyList")
  
      End Sub
  
      Private Sub NotifyPropertyChanged(ByVal info As String)
          RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(info))
      End Sub
  
      Public Event PropertyChanged(ByVal sender As Object, _
              ByVal e As System.ComponentModel.PropertyChangedEventArgs) _
              Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged
  
  End Class
  </code></pre>
  
  <p>Here is the XAML:</p>
  
  <pre><code>&lt;Window x:Class="Window1"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="Window1" Height="300" Width="300"
      xmlns:local="clr-namespace:WpfApplication1"
          &gt;
  
      &lt;Window.Resources&gt;
          &lt;ObjectDataProvider x:Key="MyListObject" ObjectType="{x:Type local:MyListObject}"/&gt;
      &lt;/Window.Resources&gt;
  
          &lt;Grid&gt;
  
          &lt;ComboBox Height="23"
                    Margin="24,91,53,0"
                    Name="ComboBox1"
                    VerticalAlignment="Top" 
                    ItemsSource="{Binding Path=MyList, Source={StaticResource MyListObject}}"
                    /&gt;
          &lt;TextBox Height="23"
                   Margin="24,43,134,0"
                   Name="TextBox1"
                   VerticalAlignment="Top" /&gt;
          &lt;Button Height="23"
                  HorizontalAlignment="Right"
                  Margin="0,43,53,0"
                  Name="btn_AddName"
                  VerticalAlignment="Top"
                  Width="75"&gt;Add&lt;/Button&gt;
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>And here's the simple code-behind:</p>
  
  <pre><code>Class Window1 
  
      Private obj As New MyListObject
  
      Private Sub btn_AddName_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) _ 
      Handles btn_AddName.Click
  
          obj.AddName(TextBox1.Text)
  
      End Sub
  End Class
  </code></pre>
  
  <p>Thanks!</p>