title: WPF: DataGrid Display Error
body: <p>I have a DataGrid with 3 columns, 2 of which are DataGridTextColumns and the last is a DataGridTemplateColumn that contains a CheckBox. It is bound to an ObservableCollection of Field objects.</p>
  
  <p>The user can change the data in the DataGrid based on the SelectedItem of a ComboBox, which appears just above the DataGrid. This ComboBox is bound to a List of RecordType objects. I chose a List as the values in it do not change.</p>
  
  <p>The problem I'm having is strange. Sometimes, but not always (the error is very temperamental), when changing the value in the ComboBox, the rows in the DataGrid display oddly (please see the screenshot) as you scroll down the list. Certain rows in the DataGrid appear with a small grey area to the left hand side of them and the row's content is pushed to the right, making it difficult to read the cells' values. As you continue to scroll up or down, so other cells display in the same way, though the problem only seems to affect a minimal number of rows, 5 at max roughly. The rows affected are not always the same and can change as the ComboBox item is changed.</p>
  
  <p>To confirm, I have blanked out certain Field names in the screenshot to protect our client's privacy.</p>
  
  <p>Could anyone suggest what might be causing this display issue? The XAML code I'm using for the ComboBox and DataGrid is given below.</p>
  
  <p>Any suggestions/comments/help would be greatly appreciated. </p>
  
  <p>Many thanks!</p>
  
  <pre><code>&lt;ComboBox ItemsSource="{Binding RecordTypes}" SelectedItem="{Binding SelectedRecordType}" DisplayMemberPath="DisplayName" HorizontalAlignment="Left" Margin="9,71,0,0" VerticalAlignment="Top" Width="195"/&gt;
  &lt;DataGrid SelectedItem="{Binding SelectedField}" ItemsSource="{Binding Fields}" GridLinesVisibility="None" AutoGenerateColumns="False" HorizontalAlignment="Left" Margin="10,98,0,0" VerticalAlignment="Top" Height="385" Width="400" IsReadOnly="True" CanUserReorderColumns="False" CanUserResizeRows="False" HeadersVisibility="Column" SelectionMode="Single" MaxColumnWidth="300"&gt;
      &lt;DataGrid.CellStyle&gt;
          &lt;Style TargetType="DataGridCell"&gt;
              &lt;Setter Property="BorderThickness" Value="0" /&gt;
              &lt;Setter Property="ToolTip" Value="{Binding Description}" /&gt;
              &lt;Style.Triggers&gt;
                  &lt;Trigger Property="ToolTip" Value="{x:Static system:String.Empty}"&gt;
                      &lt;Setter Property="ToolTipService.IsEnabled" Value="False" /&gt;
                  &lt;/Trigger&gt;
              &lt;/Style.Triggers&gt;
          &lt;/Style&gt;
      &lt;/DataGrid.CellStyle&gt;
      &lt;DataGrid.Columns&gt;
          &lt;DataGridTextColumn Binding="{Binding DisplayName}" Header="Field" Width="150" /&gt;
          &lt;DataGridTextColumn Binding="{Binding DisplayPath}" Header="Path" Width="*" /&gt;
          &lt;DataGridTemplateColumn MinWidth="25" MaxWidth="25"&gt;
              &lt;DataGridTemplateColumn.CellTemplate&gt;
                  &lt;DataTemplate&gt;
                      &lt;CheckBox IsChecked="{Binding IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="5" /&gt;
                  &lt;/DataTemplate&gt;
              &lt;/DataGridTemplateColumn.CellTemplate&gt;
          &lt;/DataGridTemplateColumn&gt;
      &lt;/DataGrid.Columns&gt;
  &lt;/DataGrid&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/68c7h.png" alt=""></p>