namespace Xceed.Wpf.Toolkit.PropertyGrid.Editors
{
public class PrimitiveTypeCollectionEditor : TypeEditor
{
protected override void SetControlProperties()
{
Editor.BorderThickness = new System.Windows.Thickness(0);
Editor.Content = "(Collection)";
}
protected override void SetValueDependencyProperty()
{
ValueProperty = Xceed.Wpf.Toolkit.PrimitiveTypeCollectionEditor.ItemsSourceProperty;
}
protected override void ResolveValueBinding(PropertyItem propertyItem)
{
Editor.ItemsSourceType = propertyItem.PropertyType;
//EO: Next line should be modified to support Array also
//old line: Editor.ItemType = propertyItem.PropertyType.GetGenericArguments()[0];
// Replaced with next "if-else"
if (propertyItem.PropertyType.IsGenericType)
{
Editor.ItemType = propertyItem.PropertyType.GetGenericArguments()[0];
}
else
{
Editor.ItemType = propertyItem.PropertyType.GetElementType();
}
base.ResolveValueBinding(propertyItem);
}
}
}
Comments: Fixed
{
public class PrimitiveTypeCollectionEditor : TypeEditor
{
protected override void SetControlProperties()
{
Editor.BorderThickness = new System.Windows.Thickness(0);
Editor.Content = "(Collection)";
}
protected override void SetValueDependencyProperty()
{
ValueProperty = Xceed.Wpf.Toolkit.PrimitiveTypeCollectionEditor.ItemsSourceProperty;
}
protected override void ResolveValueBinding(PropertyItem propertyItem)
{
Editor.ItemsSourceType = propertyItem.PropertyType;
//EO: Next line should be modified to support Array also
//old line: Editor.ItemType = propertyItem.PropertyType.GetGenericArguments()[0];
// Replaced with next "if-else"
if (propertyItem.PropertyType.IsGenericType)
{
Editor.ItemType = propertyItem.PropertyType.GetGenericArguments()[0];
}
else
{
Editor.ItemType = propertyItem.PropertyType.GetElementType();
}
base.ResolveValueBinding(propertyItem);
}
}
}
Comments: Fixed