title: How to refresh a listview control after editting an item?
body: <p>I started playing with the wpf listview control. I've created an "add" button and an "edit" button.
  The "add" button works as expected - whenever I'm adding a new item to the list it gets displayed.
  My problem is with the "edit" button - what is the correct way of informing the listView control that an item was changed? (it works in the attached code, i just wanted to know if there is a better way)</p>
  
  <p>This is my code:</p>
  
  <p>Xaml:</p>
  
  <pre><code>&lt;Window x:Class="WpfApplication5.MainWindow" Name="This"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="MainWindow" Height="350" Width="525"
      &gt;
  &lt;Grid&gt;
      &lt;ListView   Name="Mylist"
                  ItemsSource= "{Binding ElementName=This, Path=People}"
                  SelectionMode="Single"
                  &gt;
          &lt;ListView.View&gt;
                  &lt;GridView AllowsColumnReorder="false"&gt;
                      &lt;GridViewColumn 
                              Header="Name" 
                              Width="Auto" 
                              DisplayMemberBinding="{Binding Path=Name}" /&gt;
                      &lt;GridViewColumn 
                              Header="Id" 
                              Width="Auto" 
                              DisplayMemberBinding="{Binding Path=Id}" /&gt;
                  &lt;/GridView&gt;
              &lt;/ListView.View&gt;
      &lt;/ListView&gt;
      &lt;StackPanel Orientation="Horizontal" Height="45" Margin="190,133,197,133"&gt;
          &lt;Button 
                      Content="Add"
                      Click="AddButton_Click"
                      /&gt;
          &lt;Button 
                      Content="Edit"
                      Click="EditButton_Click"
                      /&gt;
      &lt;/StackPanel&gt;
  &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>Code Behind:</p>
  
  <pre><code>namespace WpfApplication5
  {
  public class PersonalDetails
  {
      public string Name {get; set;}
      public string Id {get; set;}
  }
  
  public partial class MainWindow : Window
  {
      private ObservableCollection&lt;PersonalDetails&gt; people = new ObservableCollection&lt;PersonalDetails&gt;();
      public ObservableCollection&lt;PersonalDetails&gt; People
      {
          get { return this.people; }
      }
  
      public MainWindow()
      {
          PersonalDetails p1 = new PersonalDetails();
          p1.Name = "Jeff";
          p1.Id = "111";
          people.Add(p1);
          InitializeComponent();
      }
  
      private void AddButton_Click(object sender, System.Windows.RoutedEventArgs e)
      {
          PersonalDetails p2 = new PersonalDetails();
          p2.Name = "Tom";
          p2.Id = "222";
          people.Add(p2);
      }
  
      private void EditButton_Click(object sender, System.Windows.RoutedEventArgs e)
      {
          PersonalDetails pItem = (PersonalDetails)Mylist.SelectedItem;
          if (pItem == null)
          {
              return;
          }
          pItem.Name = "Dan";
          Mylist.Items.Refresh();
  
      }
  
  }
  }
  </code></pre>