Edit

Share via


ITypedList.GetItemProperties(PropertyDescriptor[]) Method

Definition

Returns the PropertyDescriptorCollection that represents the properties on each item used to bind data.

public:
 System::ComponentModel::PropertyDescriptorCollection ^ GetItemProperties(cli::array <System::ComponentModel::PropertyDescriptor ^> ^ listAccessors);
public System.ComponentModel.PropertyDescriptorCollection GetItemProperties (System.ComponentModel.PropertyDescriptor[] listAccessors);
public System.ComponentModel.PropertyDescriptorCollection GetItemProperties (System.ComponentModel.PropertyDescriptor[]? listAccessors);
abstract member GetItemProperties : System.ComponentModel.PropertyDescriptor[] -> System.ComponentModel.PropertyDescriptorCollection
Public Function GetItemProperties (listAccessors As PropertyDescriptor()) As PropertyDescriptorCollection

Parameters

listAccessors
PropertyDescriptor[]

An array of PropertyDescriptor objects to find in the collection as bindable. This can be null.

Returns

The PropertyDescriptorCollection that represents the properties on each item used to bind data.

Examples

The following code example demonstrates how to implement the GetItemProperties method. For a full code listing, see How to: Implement the ITypedList Interface.

public PropertyDescriptorCollection GetItemProperties(PropertyDescriptor[] listAccessors)
{
    PropertyDescriptorCollection pdc;

    if (listAccessors!=null && listAccessors.Length>0)
    {
        // Return child list shape.
        pdc = ListBindingHelper.GetListItemProperties(listAccessors[0].PropertyType);
    }
    else
    {
        // Return properties in sort order.
        pdc = properties;
    }

    return pdc;
}
Public Function GetItemProperties(ByVal listAccessors() As System.ComponentModel.PropertyDescriptor) As System.ComponentModel.PropertyDescriptorCollection Implements System.ComponentModel.ITypedList.GetItemProperties

    Dim pdc As PropertyDescriptorCollection

    If (Not (listAccessors Is Nothing)) And (listAccessors.Length > 0) Then
        ' Return child list shape
        pdc = ListBindingHelper.GetListItemProperties(listAccessors(0).PropertyType)
    Else
        ' Return properties in sort order
        pdc = properties
    End If

    Return pdc

End Function

Remarks

If the listAccessors parameter is not null, it typically contains a property descriptor that identifies a list of containers to retrieve for the object that implements ITypedList. For example, a DataSet containing two tables, myCustomers and myOrders, with a relationship between them called myCustOrders. If you create a DataView object to view myCustomers, then calling the GetItemProperties method with null returns the property descriptors for the columns in myCustomers. As a result, one of the returned property descriptors is a property descriptor for myCustOrders, just as calling the GetItemProperties method with a list accessor array containing the property descriptors for myCustOrders will return the property descriptors for myOrders.

Applies to

See also