title: How to refresh a WPF DataGrid?
body: <p>I have a WPF <code>DataGrid</code> with some data. You can add rows through a separate window. The <code>DataContext</code> is the same, a <code>LINQ-to-SQL</code> object. Binding is also the same, I bind the <code>ItemsSource</code> property to a table.</p>
  <p>In the other window, when the user clicks on <code>Save</code>, I create a row programmatically and add it using <code>InsertOnSubmit</code>. After that I use the <code>DataContext</code>'s <code>SubmitChanges</code> method.</p>
  <p>My problem is that the <code>DataGrid</code> isn't updated. If I restart the application I can see the new row, so it's in the database, but I couldn't find a way to refresh the <code>DataGrid</code>.</p>
  <p>So far I've tried to use <code>UpdateTarget</code> on the <code>BindingExpression</code> of the <code>DataGrid</code>, but it didn't help. I've also tried <code>dataGrid.Items.Refresh()</code> — same result. How can I fix this?</p>