[Mono-bugs] [Bug 664830] New: ITypedList.GetItemProperties() isn't used to get data source PropertyDescriptors

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Jan 16 17:11:14 EST 2011



           Summary: ITypedList.GetItemProperties() isn't used to get data
                    source PropertyDescriptors
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.6.x
          Platform: x86
        OS/Version: Windows 7
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: cvolzke at live.com.au
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
AppleWebKit/532.5 (KHTML, like Gecko) Chrome/ Safari/532.5

When data binding, ITypedList.GetItemProperties() isn't used to get data source
PropertyDescriptors, which limits the ability to customize PropertyDescriptors.

Reproducible: Always

Steps to Reproduce:
1. Create a BindingList subclass that implements ITypedList and
ITypedList.GetItemProperties to return a custom PropertyDescriptorCollection.
Example below.
2. Bind to the list using a custom property from the custom
MyPropertyDescriptorCollection (see sample class and custom logic below). For
example, DataBindings.Add("Text", dataSource, "ChildList.CustomProperty");

class TypedList<T> : BindingList<T>, ITypedList
    public PropertyDescriptorCollection GetItemProperties(PropertyDescriptor[]
        return new MyPropertyDescriptorCollection(
            listAccessors == null
            ? typeof(T)
            : GetListElementType(listAccessors[listAccessors.Length -

    Type GetListElementType(Type type)
        return typeof(IEnumerable).IsAssignableFrom(type) ?
ListUtil.GetListElementType(type) : type;

    public string GetListName(PropertyDescriptor[] listAccessors)
        return null;

class MyPropertyDescriptorCollection : PropertyDescriptorCollection
    public MyPropertyDescriptorCollection(Type objType)
        : base(null)
        if (objType == null)
            throw new ArgumentNullException("objType");
        ObjType = objType;
        foreach (PropertyDescriptor property in

        Add(new CustomPropertyDescriptor("CustomProperty", "CustomValue"));

    public Type ObjType { get; private set; }

Actual Results:  
Data binding will fail as the CustomProperty won't be found.

Expected Results:  
Data binding should succeed, and 'CustomValue' should be set on the control's
Text property.

To fix, inside the Binding class change all:
    TypeDescriptor.GetProperties (manager.Current)
    TypeDescriptor.GetProperties (manager.GetItemProperties())

Easy fix!

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list