title: C# Winforms ListBox Set BackColor when item meets condition
body: <p>I have a collection that is the DataSource of a ListBox.
  I'd like to enumerate the ListBox items and change the BackColor when the collection item has a certain property. The code in the for isn't working at all and i'm lost.
  How would i change the BackColor is the corresponding Categorie has a certain ID ?</p>
  
  <pre><code>  categorien.Add(new Categorie() { ID = 0, Naam = "Blond" });
    categorien.Add(new Categorie() { ID = 1, Naam = "Donker" });
    listBox1.DataSource = categorien;
    listBox1.DisplayMember = "Naam";
    listBox1.ValueMember = "ID";
  
    for (int i = 0; i &lt; listBox1.Items.Count; i++ ) {
      if (categorien.ID == someID) {
        listBox1.Items[i].BackColor = Color.Gray;
      }
    }
  </code></pre>