title: Setting a GridView's colour in WPF via code
body: <p>I've been searching for quite a long time how to do this. I don't know how to set the colour of a row item in the GridView (WPF) using <em>code</em> I don't want an example in XAML</p>
  
  <p>My data comes from me loading &amp; pulling apart an XML file. I then put it into a small class with properties and those are bound to the column to populate the data. Later, it can begin some functions on the table's data. Because this takes at some times over 10 minutes it's on a thread &amp; I would like to colour the rows I've completed parsing depending on the result. (IE: Red for HTTP error, Orange for XML parsing error ect...)</p>
  
  <p>This is the GridView's XAML:</p>
  
  <pre><code>&lt;ListView Name="RepoListView" Margin="0,22,0,0"&gt;
    &lt;ListView.View&gt;
      &lt;GridView AllowsColumnReorder="True"&gt;
        &lt;GridViewColumn Header="Title" DisplayMemberBinding="{Binding title}" /&gt;
        &lt;GridViewColumn Header="URL" DisplayMemberBinding="{Binding url}" /&gt;
        &lt;GridViewColumn Header="Subscriptions" DisplayMemberBinding="{Binding dlc}" /&gt;
      &lt;/GridView&gt;
    &lt;/ListView.View&gt;
  &lt;/ListView&gt;
  </code></pre>
  
  <p>I am then parsing the data using the url column. I am currently changing the selected item as I go through. I want to know if theres something I can do to change the specific item. Let's assume I'm on row 500:</p>
  
  <p>I use: setSelected(i) which uses Dispatcher to safely change the selected row. Is there anything I can do to change the colour as well? I've been trying for hours to find a solution.</p>
  
  <p>Thanks</p>