You either need to find the item you want to remove:
var itemToRemove = CV.GroupDescriptions
.OfType<PropertyGroupDescription>()
.FirstOrDefault(pgd => pgd.PropertyName == "Level");
if (itemToRemove != null)
{
CV.GroupDescriptions.Remove(itemToRemove);
}
or find its index and use
RemoveAt
:
for (int index = 0; index < CV.GroupDescriptions.Count; index++)
{
var pgd = CV.GroupDescriptions[index] as PropertyGroupDescription;
if (pgd != null && pgd.PropertyName == "Level")
{
CV.GroupDescriptions.RemoveAt(index);
break;
}
}