title: Modify View after Binding Command Executes
body: <p>I have a <code>DataGrid</code> and two buttons. Pressing the first button will call a command that populates my DataGrid from a database table using a <code>DataTable</code>. The second button will apply some logic and eventually remove the data from the database table. My problem is, after I select the second button, the DataGrid does not update and still shows the row that do not exist in the database anymore. Here is my setup:</p>
  
  <p>Button1 (Populates the DataGrid):</p>
  
  <pre><code>&lt;Button Content="Load Data" Command="{Binding FillMyDataTableCommand}"/&gt;
  </code></pre>
  
  <p>DataGrid:</p>
  
  <pre><code>&lt;DataGrid ItemsSource="{Binding MyDataTable}"&gt;
  </code></pre>
  
  <p>Button2 (Applies logic and the data should not be in the table anymore):</p>
  
  <pre><code>&lt;Button Command="{Binding StartCommand}" CommandParameter="{Binding ElementName=myDataGrid}"&lt;/Button&gt;
  </code></pre>
  
  <p>On selecting button2, my ViewModel takes care of the logic, after the logic I would like to update the datagrid to display the changes to the table with:</p>
  
  <pre><code>myDataGrid.Items.Refresh();
  </code></pre>
  
  <p>I can not do this in the ViewModel as that would violate MVVM as it should know nothing about the view. I tried a workaround by adding to the code behind for the button with a click command hoping it would execute after the binding command. However it executed first:</p>
  
  <p>Button2 (attempt):</p>
  
  <pre><code>&lt;Button Command="{Binding StartCommand}" CommandParameter="{Binding ElementName=myDataGrid}" click="button_click_Refresh"&lt;/Button&gt;
  </code></pre>
  
  <p>How can I solve this?</p>