1

Closed

Exception on missing Category (=null)

description

If bound to an object without property categories there is an exception.
 
Please chenge code to
 
public PropertyCollection(object instance, bool noCategory, bool automaticlyExpandObjects, string filter)
{
:
            foreach (Property property in propertyCollection)
            {
                if (filter == "" || property.Name.ToLower().Contains(filter))
                {
                    PropertyCategory propertyCategory;
                  var category = property.Category ?? string.Empty;             // null category handled here
                  if (groups.ContainsKey(category))
                    {
                      propertyCategory = groups[category];
                    }
                    else
                    {
                        propertyCategory = new PropertyCategory(property.Category);
                        groups[category] = propertyCategory;
                        Items.Add(propertyCategory);
                    }
                    propertyCategory.Items.Add(property);
                }
            }
:
}
Closed Jan 5, 2011 at 9:10 AM by jogibear9988
Fixed

comments