ITypedList.GetItemProperties(PropertyDescriptor[]) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回 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
,则使用 null
调用 GetItemProperties 方法将返回 中myCustomers
列的属性描述符。 因此,返回的属性描述符之一是 的属性描述符,myCustOrders
就像使用包含 属性描述myCustOrders
符的列表访问器数组调用 GetItemProperties 方法将返回 的属性描述符一myOrders
样。