title: Two-way binding in DataGrid: source not updated
body: <p>I have an issue on a two-way binding that works fine from source to target, but updates on the target are never propagated to the source.</p>
  
  <p>I display in a DataGrid a custom UserControl that shows a rating with stars:</p>
  
  <p><strong>* View.xaml</strong>
  </p>
  
  <pre><code>    &lt;DataGrid x:Name="Datagrid" Style="{StaticResource ResourceKey=DataGridStyle}" Grid.Row="1" AutoGenerateColumns="False" IsReadOnly="True" ItemsSource="{Binding Path=GameList}" SelectedItem="{Binding Path=SelectedGame}" SelectionChanged="datagrid_SelectionChanged"&gt;
          &lt;DataGrid.Columns&gt;
              &lt;DataGridTextColumn Header="Title" Binding="{Binding Title}" /&gt;
              &lt;DataGridTemplateColumn Header="Rating" SortMemberPath="Rating"&gt;
                  &lt;DataGridTemplateColumn.CellTemplate&gt;
                      &lt;DataTemplate&gt;
                          &lt;controls:RatingControl NumberOfStars="{Binding Path=Rating}" /&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/DataGridTemplateColumn.CellTemplate&gt;
              &lt;/DataGridTemplateColumn&gt;
          &lt;/DataGrid.Columns&gt;
      &lt;/DataGrid&gt;
  </code></pre>
  
  <p><strong>* RatingControl.xaml.cs</strong>
  </p>
  
  <pre><code>public partial class RatingControl : UserControl
  {
      #region Public Dependency properties
      public int NumberOfStars
      {
          get { return (int)GetValue(NumberOfStarsProperty); }
          set { if ((int)GetValue(NumberOfStarsProperty) != value) { SetValue(NumberOfStarsProperty, value); } }
      }
  
      public static readonly DependencyProperty NumberOfStarsProperty =
          DependencyProperty.Register("NumberOfStars", typeof(int), typeof(RatingControl), 
            new FrameworkPropertyMetadata(0, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnRatingChanged));
  
      #endregion
  
      [...]
  
      private void Border_PreviewMouseDown(object sender, MouseButtonEventArgs e)
      {
          e.Handled = true;
          NumberOfStars = tempRating;
      }
  </code></pre>
  
  <p><strong>* Game.cs</strong>
  </p>
  
  <pre><code>public class Game : INotifyPropertyChanged
  {
      private int _rating;
      public int Rating
      {
          get { return _rating; }
          set { _rating = value; RaiseChangedEvent("Rating"); }
      }
      public event PropertyChangedEventHandler PropertyChanged;
  
      public void RaiseChangedEvent(string propertyName)
      {
          if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
      }
  }
  </code></pre>
  
  <p>When I click on a star on RatingControl, I update the NumberOfStars dependency property, but the Rating property of my model is not updated. What am I missing ?</p>