In PrepareGrouping(), you look for a potentially nested items source (ie. grouping required by the user) by checking whether it has IEnumerable elements. But there is a standard type that's not really a list but is still IEnumerable: string. If the source is a list of strings, it will be mistaken for a nested list. So:
//Get the groups within the items source.
var groups = _items.OfType<IEnumerable>().Where(grp => !(grp is string));
In
PrepareGrouping(),
you look for a potentially nested items source (ie. grouping required by the user) by checking whether it hasIEnumerable
elements. But there is a standard type that's not really a list but is stillIEnumerable
: string. If the source is a list of strings, it will be mistaken for a nested list. So: