title: ListViewGroups not working correctly
body: <p>I'm working with a ListView control in Windows Forms using C# and .NET 3.5. I have several items that I'm adding to this ListView control, and I have functionality in place that is supposed to allow the user to select different ways to group the items in the list. However, sometimes items get dumped into the automatically generated "Default" group for no explicable reason.</p>
  
  <p>The code is too large to just put here, but let me explain what I'm doing algorithmically. Suppose we're starting with a ListView that contains items and may or may not already contain groups.</p>
  
  <ol>
  <li>Cycle through every item and set
  it's Group property to null.</li>
  <li>Empty the ListView's Groups
  collection.</li>
  <li>Add new Groups to the ListView's
  Group collection.</li>
  <li>Cycle through every item and set the
  Group property using a value
  obtained from the ListView's Group
  collection via index.</li>
  </ol>
  
  <p>I've stepped through the code and observed everything as it should be. With each item it obtains the appropriate group from the ListView's Group collection and sets the Group property of the item, yet sometimes they end up listed under the "Default" group.</p>
  
  <p>Has anyone else ever observed this or have any theories as to why it might be happening?</p>