title: WPF Observablecollection with INotifyPropertyChanged for ListView doesn't work
body: <p>I have a wpf application and I want to update my listview when I add new value through the UI using Observablecollect. But I don't get what I expect. When I add new value I won't update my list view.</p>
  
  <p>Here is my CS file.</p>
  
  <pre><code> using System.Collections.ObjectModel;
   using System.ComponentModel;
   using System.Data.SqlClient;
   using System.Windows;
  
   namespace ObservableCollectionTest
  {
  /// &lt;summary&gt;
  /// Interaction logic for MainWindow.xaml
  /// &lt;/summary&gt;
  public partial class MainWindow : Window
  {
      public ObservableCollection&lt;TestUser&gt; NameList { get; set; }
  
      public MainWindow()
      {
          InitializeComponent();
          NameList = GetNamesFromDBAsStringList();
          ListViewNames.ItemsSource = NameList;
          this.DataContext = this;
      }
  
      private void Button_Click_1(object sender, RoutedEventArgs e)
      {
          TestUser user = new TestUser();
          user.UserName = txtName.Text;
          NameList.Add(user);
  
          //InsertUserName(txtName.Text);
          //NameList = GetNamesFromDBAsStringList();
  
          txtName.Clear();
          MessageBox.Show("User added");
      }
  
      private ObservableCollection&lt;TestUser&gt; GetNamesFromDBAsStringList()
      {
          ObservableCollection&lt;TestUser&gt; userList = new ObservableCollection&lt;TestUser&gt;();
  
          SqlConnection connection = new SqlConnection("Data Source=Chakrapani\\SQLEXPRESS;Initial Catalog=Test;Integrated Security=True");
          connection.Open();
          string sql = "select UserID,UserName from TestUser";
          SqlCommand command = new SqlCommand(sql, connection);
          SqlDataReader reader = command.ExecuteReader();
          while (reader.Read())
          {
              TestUser testUser = new TestUser();
              testUser.UserID = (int)reader[0];
              testUser.UserName = reader[1].ToString();
              userList.Add(testUser);
          }
          reader.Close();
          connection.Close();
  
          return userList;
      }
  
      private void InsertUserName(string userName)
      {
          SqlConnection connection = new SqlConnection("Data Source=CHAKRAPANI\\SQLEXPRESS;Initial Catalog=Test;Integrated Security=True");
          connection.Open();
          string sql = string.Format("insert into TestUser values ('{0}')", userName);
          SqlCommand command = new SqlCommand(sql, connection);
          command.ExecuteNonQuery();
  
          connection.Close();
      }
  }
  
  public class TestUser : INotifyPropertyChanged
  {
      private int _userId;
      private string _userName;
  
      public int UserID
      {
          get { return _userId; }
          set
          {
              _userId = value;
              NotifyPropertyChanged("UserID");
          }
      }
      public string UserName
      {
          get { return _userName; }
          set
          {
              _userName = value;
              NotifyPropertyChanged("UserName");
          }
      }
  
      public event PropertyChangedEventHandler PropertyChanged;
      private void NotifyPropertyChanged(string propertyName)
      {
          if (PropertyChanged != null)
              PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
      }
  }
  }
  </code></pre>
  
  <p>And this is my xaml file</p>
  
  <pre><code>&lt;Window x:Class="ObservableCollectionTest.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="MainWindow" Height="350" Width="396"&gt;
  &lt;Grid&gt;
      &lt;Button Content="Add User" HorizontalAlignment="Left" Margin="300,10,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click_1" Name="BtnAdd"/&gt;
      &lt;TextBox HorizontalAlignment="Left" Height="23" Margin="10,10,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="264" Name="txtName"/&gt;
      &lt;ListView HorizontalAlignment="Left" Height="259" Margin="10,51,0,0" VerticalAlignment="Top" Width="264" Name="ListViewNames" ItemsSource="{Binding MyUserNameList}"&gt;
          &lt;ListView.View&gt;
              &lt;GridView&gt;
                  &lt;GridViewColumn Header="User ID" DisplayMemberBinding="{Binding UserID}"/&gt;
                  &lt;GridViewColumn Header="User Name" DisplayMemberBinding="{Binding UserName}"/&gt;
              &lt;/GridView&gt;
          &lt;/ListView.View&gt;
      &lt;/ListView&gt;
  
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>Please give me a clue to handle the problem.</p>