title: Wpf - problem with binding to a collection item
body: <p>this is my simple xaml that shows in a textbox the age of the first person in a collection of persons. I don't understand I after click the age isn't changing.</p>
  
  <pre><code> &lt;Grid&gt;
      &lt;Grid.RowDefinitions&gt;
          &lt;RowDefinition Height="132*" /&gt;
          &lt;RowDefinition Height="179*" /&gt;
      &lt;/Grid.RowDefinitions&gt;
      &lt;TextBlock Text="{Binding Persons[0].Age}" /&gt;
      &lt;Button Grid.Row="1" Click="Button_Click"&gt;Change Age&lt;/Button&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p>this is the code behind of the xaml:</p>
  
  <pre><code> public partial class MainWindow : Window
  {
      public ObservableCollection&lt;Person&gt; Persons { get; set; }
  
      public MainWindow() {
          Persons = new ObservableCollection&lt;Person&gt;();
          Persons.Add(new Person{Age = -1});
  
          DataContext = this;
          InitializeComponent();
      }
  
      private void Button_Click(object sender, RoutedEventArgs e) {
          (Persons[0] as Person).Age = 5;
      }
  }
  </code></pre>
  
  <p>this is class person:</p>
  
  <pre><code> public class Person : INotifyPropertyChanged
  {
      private int _age;
  
      public int Age
      {
          get { return _age; }
          set
          {
              _age = value;
              if (PropertyChanged != null)
              {
                  PropertyChanged(this, new PropertyChangedEventArgs("Age"));
              }
          }
      }
  
      #region INotifyPropertyChanged Members
  
      public event PropertyChangedEventHandler PropertyChanged;
  
      #endregion
  }
  </code></pre>