ITypedList.GetItemProperties(PropertyDescriptor[]) 方法

定義

傳回代表繫結資料所用各項目屬性的 PropertyDescriptorCollection

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

參數

listAccessors
PropertyDescriptor[]

尋找在集合中顯示為可繫結的 PropertyDescriptor 物件陣列。 這可以是 null

傳回

代表繫結資料所用各項目屬性的 PropertyDescriptorCollection

範例

下列程式代碼範例示範如何實作 GetItemProperties 方法。 如需完整的程式代碼清單,請參閱 如何:實作 ITypedList 介面

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

備註

listAccessors如果 參數不是 null,它通常會包含屬性描述項,可識別要針對實ITypedList作 的物件擷取的容器清單。 例如,包含 DataSet 兩個數據表的 myCustomers ,以及 myOrders兩個數據表之間的關聯性,稱為 myCustOrders。 如果您建立 DataView 對象來檢視 myCustomers,則呼叫 GetItemProperties 方法時 null 會傳回 中數據行 myCustomers的屬性描述項。 因此,其中一個傳回的屬性描述元是 的屬性描述項myCustOrders,就像使用包含 屬性描述元myCustOrders的清單存取子陣列呼叫 GetItemProperties 方法,將會傳回 的屬性描述元myOrders

適用於

另請參閱