windowsforms-devexpress-dot-xtraverticalgrid-dot-propertygridcontrol-ba89abe4.md
Gets or sets whether rows are automatically created in the control for all fields in the bound object.
Namespace : DevExpress.XtraVerticalGrid
Assembly : DevExpress.XtraVerticalGrid.v25.2.dll
NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid
public bool AutoGenerateRows { get; set; }
Public Property AutoGenerateRows As Boolean
| Type | Description |
|---|---|
| Boolean |
true , if the control automatically re-creates rows when you re-bind an object; false , if the control automatically creates rows only when you bind an object for the first time.
|
The SelectedObject and SelectedObjects properties allow you to specify the object(s) whose properties are displayed in the control.
propertyGridControl1.SelectedObject = myObject1;
PropertyGridControl1.SelectedObject = myObject1
The control displays properties annotated with the Browsable attribute set to Yes.
[Browsable(true)]
public int MyProperty { get; set; }
<Browsable(True)>
Public Property MyProperty() As Integer
Use the BrowsableAttributes collection to enable the control to show properties annotated with a specific attribute. The code below enables the control to show properties annotated with the Browsable attribute set to No.
propertyGridControl1.BrowsableAttributes = new AttributeCollection(new Attribute[] { BrowsableAttribute.No });
PropertyGridControl1.BrowsableAttributes = New AttributeCollection(New Attribute() {BrowsableAttribute.No})
The AutoGenerateRows property specifies whether the control automatically re-creates rows (see the Rows collection) when you re-bind an object or change the attribute collection. If this property is enabled, you can display multiple different-type objects during the application run.
If this property is set to false , the control automatically creates rows only when you bind an object for the first time. To create rows manually when you re-bind an object or change the attribute collection, call the RetrieveFields method.
Note
Since version 17.1, the default value is true. If the static (Shared in VB) WindowsFormsSettings.DefaultSettingsCompatibilityMode property is set to v16 , the default value is false. See Version Compatibility: Default Property Values for more information.
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AutoGenerateRows property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
winforms-property-grid-create-rows/CS/AddRowsRuntime/Form1.cs#L17
private void Form1_Load(object sender, EventArgs e) {
propertyGridControl1.AutoGenerateRows = false;
CreateRows();
winforms-property-grid-create-rows/VB/AddRowsRuntime/Form1.vb#L17
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
propertyGridControl1.AutoGenerateRows = False
CreateRows()
See Also