DetailsView.CreateFieldSet(Object, Boolean) 方法

定义

创建用来生成控件层次结构的自动生成行字段和用户定义行字段的完整集合。Creates the complete set of automatically generated and user-defined row fields used to generate the control hierarchy.

protected:
 virtual System::Collections::ICollection ^ CreateFieldSet(System::Object ^ dataItem, bool useDataSource);
protected virtual System.Collections.ICollection CreateFieldSet (object dataItem, bool useDataSource);
abstract member CreateFieldSet : obj * bool -> System.Collections.ICollection
override this.CreateFieldSet : obj * bool -> System.Collections.ICollection
Protected Overridable Function CreateFieldSet (dataItem As Object, useDataSource As Boolean) As ICollection

参数

dataItem
Object

数据项,将对其创建行字段。The data item for which to create the row fields.

useDataSource
Boolean

true 表示使用该数据项创建自动生成的行字段;否则为 falsetrue to use the data item to create the automatically generated row fields; otherwise, false.

返回

一个 ICollection,包含针对指定数据项的自动生成行字段和用户定义行字段。An ICollection that contains both the automatically generated and the user-defined row fields for the specified data item.

注解

方法是一个帮助器方法, 该DetailsView方法由控件调用以创建控件的一组完整的行字段。 CreateFieldSetThe CreateFieldSet method is a helper method called by the DetailsView control to create the complete set of row fields for the control. 如果将true属性设置为, 则自动生成的行字段将追加到Fields集合中包含的用户定义行字段。 AutoGenerateRowsIf the AutoGenerateRows property is set to true, automatically generated row fields are appended to the user-defined row fields contained in the Fields collection. 若要基于数据项创建自动生成的行字段, 请传入true useDataSource参数; 否则, 将基于控件中现有行字段的属性创建自动生成的行字段。To create the automatically generated row fields based on the data item, pass in true for the useDataSource parameter; otherwise, the automatically generated row fields are created based on properties of the existing row fields in the control.

继承者说明

扩展DetailsView类时, 可以重写此方法以创建自己的行字段集。When extending the DetailsView class, you can override this method to create your own set of row fields.

适用于

另请参阅