title: WPF - Why doesn't my binding act 2 way?
body: <p>I've been struggling to get my head around data binding with WPF and receiving edits made to a datagrid for an ObservableCollection. </p>
  
  <p>I made a datagrid designed to allow the user only to edit existing value for a point (X and Y), with an ObservableCollection holding them called <em>coordinates</em></p>
  
  <p>The grid successfully fills with whatever data is in <em>coordinates</em>. However, whenever I change the X or Y value in the data grid (of which there is a duplicate column for X and Y seem to be made, for some reason), it is not updated in <em>coordinates</em> (shown when i use the console). Why is this the case?</p>
  
  <p>Here is the XAML code: </p>
  
  <pre><code>            &lt;DataGrid x:Name="XYDataGrid" 
                      CanUserSortColumns="False" 
                      CanUserReorderColumns="False"
                      CanUserResizeColumns="False"
                      CanUserResizeRows="False"
                      ColumnWidth="*"
                      ItemsSource="{Binding}"
                      LostFocus="XYDataGrid_LostFocus"&gt;
              &lt;DataGrid.Columns&gt;
                  &lt;DataGridTextColumn Header="X" Binding="{Binding X, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/&gt;
                  &lt;DataGridTextColumn Header="Y" Binding="{Binding Y, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/&gt;
              &lt;/DataGrid.Columns&gt;
          &lt;/DataGrid&gt;
  </code></pre>
  
  <p>And in my C#:         </p>
  
  <pre><code>    private ObservableCollection&lt;Point&gt; coordinates = new ObservableCollection&lt;Point&gt;();
  
      public MainWindow()
      {
          InitializeComponent();
  
          coordinates.Add(new Point()
          {
              X = 1,
              Y = 1
          });
  
          this.DataContext = coordinates;            
      }
  
      private void XYDataGrid_LostFocus(object sender, RoutedEventArgs e)
      {
          Console.WriteLine((coordinates[0].X).ToString());
  
      }
  </code></pre>