title: When using DataTable and DataGrid in WPF System.Windows.Data Error occurs
body: <p>I use DataGrid of WPFToolkit to display some data. </p>
  
  <p>The DataTable is initialized in myfile.xaml.cs with</p>
  
  <pre><code>myTable = new DataTable();
  DataColumn col;
  col = new DataColumn();
  col.DataType = System.Type.GetType("System.Int64");
  col.ColumnName = "ID";
  col.ReadOnly = true;
  col.Unique = false;
  myTable.Columns.Add(col);
  
  col = new DataColumn();
  col.DataType = System.Type.GetType("System.String");
  col.ColumnName = "Name";
  col.ReadOnly = true;
  col.Unique = false;
  myTable.Columns.Add(col);
  </code></pre>
  
  <p>and so on.</p>
  
  <p>As suggested here I use </p>
  
  <pre><code>myGrid.ItemsSource = myTable.DefaultView;
  </code></pre>
  
  <p>in myfile.xaml.cs. </p>
  
  <p>In myfile.xaml I have only defined</p>
  
  <pre><code>&lt;my:DataGrid Name="myGrid" xmlns:my="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"/&gt;
  </code></pre>
  
  <p>When I add an entry to the table with </p>
  
  <pre><code>DataRow row = myTable.NewRow();
  row["ID"] = 123;
  row["Name"] = "MyName";
  
  Action action = () =&gt; myTable.Rows.Add(row);
  Dispatcher.Invoke(action);
  </code></pre>
  
  <p>the entry <strong>is added correctly</strong> to the grid in the GUI, however I receive the following error:</p>
  
  <pre><code>System.Windows.Data Error: 39 : BindingExpression path error: 'ID' property not found on 'object' ''Object' (HashCode=29890231)'. BindingExpression:Path=ID; DataItem='Object' (HashCode=29890231); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
  System.Windows.Data Error: 39 : BindingExpression path error: 'Name' property not found on 'object' ''Object' (HashCode=29890231)'. BindingExpression:Path=Name; DataItem='Object' (HashCode=29890231); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
  </code></pre>
  
  <p>So how can I fix this error?
  Any hints?</p>
  
  <p>Thank you.</p>