title: Binding a WPF DataGrid to a DataTable
body: <p>I'm not good at English because I'm not a native speaker. I apologize if I've made mistakes in the language :)</p>
  
  <p>I'm new in C# and WPF and I'm trying to bind a WPF DataGrid to a DataTable in TwoWay. Now when I edit the values in the DataGrid, data in the DataTable change correctly. When I try to fill the DataTable with the following code:</p>
  
  <pre><code>OleDbDataAdapter adapter = new OleDbDataAdapter("a query", (a connection));
  adapter.Fill(dataTable);
  </code></pre>
  
  <p>the code works and the DataGrid seems all right. But when I try this:</p>
  
  <pre><code>dataTable.Rows[0][1] = (some object);
  </code></pre>
  
  <p>the display value doesn't change. I try to check the values in the DataGrid in the following way:</p>
  
  <pre><code>MessageBox.Show((SomeDataGrid.Items[0] as DataRowView).Row[1].ToString());
  </code></pre>
  
  <p>and it turns out no problem. I'm wondering why the display values are like this.</p>
  
  <p>Here's my DataGrid.CellStyle in XAML:</p>
  
  <pre><code>&lt;DataGrid.CellStyle&gt;
      &lt;Style TargetType="DataGridCell"&gt;
          &lt;Setter Property="Template"&gt;
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate TargetType="DataGridCell"&gt;
                      &lt;Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{TemplateBinding Background}"&gt;
                          &lt;DataGridDetailsPresenter HorizontalAlignment="Stretch" VerticalAlignment="Center" Content="{TemplateBinding Content}"/&gt;
                      &lt;/Grid&gt;
                  &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
          &lt;Style.Triggers&gt;
              &lt;!-- triggers --&gt;
          &lt;/Style.Triggers&gt;
      &lt;/Style&gt;
  &lt;/DataGrid.CellStyle&gt;
  </code></pre>
  
  <p>I've been stuck on this problem for several days. Thanks for any help!</p>