title: Datagrid Update Checkbox IsChecked on DataGrid.Refresh()
body: <p>I have a datagrid who's ItemsSource is a strongly typed IEnumerable object</p>
  
  <p>In this datagrid, I have a checkbox column, a price column, a part name column, and a 'total selling for' column.</p>
  
  <p>On checking the checkbox I need to update the total selling for column with the value in the price column.</p>
  
  <p>This part I have working, however, how can I get the checkbox to remain checked when this happens?</p>
  
  <pre><code>Private Sub UpdateSellFor(sender As System.Object, e As System.Windows.RoutedEventArgs)
      Dim _CB As CheckBox = DirectCast(sender, CheckBox)
      Dim _ID As Integer = _CB.Tag
      Dim _PP = DirectCast(DG_PartsToSelect.CurrentItem, PartTyping).PartPrice
      If _CB.IsChecked Then
          DG_PartsToSelect.CurrentItem.PartSellingFor = DirectCast(DG_PartsToSelect.CurrentItem, PartTyping).PartPrice
          DG_PartsToSelect.Items.Refresh()
      Else
  
      End If
      '_CB.IsChecked = True
  End Sub
  </code></pre>
  
  <p>uncommenting _CB.IsChecked = True does nothing</p>
  
  <p>Here's the XAML for this datagrid:</p>
  
  <pre><code>                &lt;DataGrid IsReadOnly="True" AutoGenerateColumns="False" Grid.Column="1" HorizontalAlignment="Stretch" Margin="3" Name="DG_PartsToSelect" VerticalAlignment="Stretch"&gt;
                      &lt;DataGrid.Columns&gt;
                          &lt;DataGridTextColumn Header="Part ID" Binding="{Binding PartID}" /&gt;
                          &lt;DataGridTemplateColumn Header="Part Name"&gt;
                              &lt;DataGridTemplateColumn.CellTemplate&gt;
                                  &lt;DataTemplate&gt;
                                      &lt;TextBlock Text="{Binding PartName}" Cursor="Hand" MouseDown="PartDetails" Tag="{Binding PartID}" ToolTip="Click to See the Part Details" /&gt;
                                  &lt;/DataTemplate&gt;
                              &lt;/DataGridTemplateColumn.CellTemplate&gt;
                          &lt;/DataGridTemplateColumn&gt;
                          &lt;DataGridTextColumn Header="Selling For" Binding="{Binding PartPrice, StringFormat='{}{0:C}'}" /&gt;
                          &lt;DataGridTemplateColumn Header="Part Options"&gt;
                              &lt;DataGridTemplateColumn.CellTemplate&gt;
                                  &lt;DataTemplate&gt;
                                      &lt;Image Cursor="Hand" Height="22" Name="options" Tag="{Binding PartID}" MouseDown="PartOptions" Source="/v2Desktop;component/Images/Application.png" ToolTip="Select Part Options" /&gt;
                                  &lt;/DataTemplate&gt;
                              &lt;/DataGridTemplateColumn.CellTemplate&gt;
                          &lt;/DataGridTemplateColumn&gt;
                          &lt;DataGridTemplateColumn Header="Sell This Part"&gt;
                              &lt;DataGridTemplateColumn.CellTemplate&gt;
                                  &lt;DataTemplate&gt;
                                      &lt;CheckBox Name="SelectedPart" Tag="{Binding PartID}" ToolTip="Select This Part" Click="UpdateSellFor" /&gt;
                                  &lt;/DataTemplate&gt;
                              &lt;/DataGridTemplateColumn.CellTemplate&gt;
                          &lt;/DataGridTemplateColumn&gt;
                          &lt;DataGridTextColumn Header="Total Selling For" Binding="{Binding PartSellingFor, StringFormat='{}{0:C}'}" /&gt;
                      &lt;/DataGrid.Columns&gt;
                  &lt;/DataGrid&gt;
  </code></pre>