Skip to main content

MultiEditorRow.PropertiesCollection Property

Gets a collection of items within a multi-editor row.

Namespace: DevExpress.XtraVerticalGrid.Rows

Assembly: DevExpress.XtraVerticalGrid.v24.1.dll

NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid

Declaration

[XtraSerializableProperty(true, true, true)]
[DXCategory("Properties")]
public MultiEditorRowPropertiesCollection PropertiesCollection { get; }

Property Value

Type Description
MultiEditorRowPropertiesCollection

A MultiEditorRowPropertiesCollection object representing a collection of multi-editor row items.

Remarks

Multi-editor rows are complex as they can consist of several items. The items in a multi-editor row are represented by instances of MultiEditorRowProperties objects. These objects are members of a specific collection maintained by a multi-editor row. The collection is represented by a MultiEditorRowPropertiesCollection object and can be accessed via the PropertiesCollection property.

When a multi-editor row is instantiated, an empty collection for row items is created automatically. So you do not need to manually create and initialize it.

You can use the PropertiesCollection property to programmatically control the collection of items in a multi-editor row. Use the properties and methods of the MultiEditorRowPropertiesCollection object obtained via this property to access a particular row item’s settings, add new or delete existing row items, move items within the collection, etc.

A particular collection item is referenced by the MultiEditorRowPropertiesCollection.Item property. This property provides access to the type specific settings of a row item specified either by its index within the PropertiesCollection or by the name of the data field to which the row item is bound. You can modify properties of the MultiEditorRowProperties object representing an individual row item’s settings to set the row item caption (via the RowProperties.Caption property), bind it to a data field (via the RowProperties.FieldName property), specify the editor type for it (via the RowProperties.RowEdit property), etc.

The items’ order in the PropertiesCollection collection determines the order in which row items are displayed within a multi-editor row.

Example

The example below demonstrates how to use both available constructors of the MultiEditorRowProperties class, the MultiEditorRow.PropertiesCollection property and MultiEditorRowPropertiesCollection.AddRange method. The sample code creates two MultiEditorRowProperties objects representing items for a multi-editor row created at runtime as well. The row is intended to represent and edit the values of two data fields (MPG City and MPG Highway) containing information about the fuel efficency of cars. Since the bound fields are of an identical data type, both row items will use the same editor of the SpinEdit type to display and edit their data. Created row items are arrayed and added to the row’s MultiEditorRow.PropertiesCollection with the help of the MultiEditorRowPropertiesCollection.AddRange method.

In the end of the example code’s execution, the multi-editor row containing two row items is added to the grid’s VGridControlBase.Rows collection.

using DevExpress.XtraVerticalGrid.Rows;
using DevExpress.XtraEditors.Repository;

// creating the first row item, specifying its caption and binding it to a data field
MultiEditorRowProperties rowItem1 = new MultiEditorRowProperties();
rowItem1.Caption = "MPG City";
rowItem1.FieldName = "MPG City";

// creating the second row item bound to a data field and specifying its caption 
MultiEditorRowProperties rowItem2 = new MultiEditorRowProperties("MPG Highway");
rowItem2.Caption = "MPG Highway";

// assigning the same editor for the created row items
RepositoryItemSpinEdit riSpin = vGridControl1.RepositoryItems.Add("SpinEdit") as 
  RepositoryItemSpinEdit;
rowItem1.RowEdit = riSpin;
rowItem2.RowEdit = riSpin;

// creating a new multi-editor row instance
MultiEditorRow newMultiEditorRow = new MultiEditorRow();
// assigning the name to the created multi-editor row
newMultiEditorRow.Name = "multiEditorRow_MPG";

// adding arrayed items to the item collection of the newly created multi-editor row
MultiEditorRowProperties [] rowItems = new MultiEditorRowProperties [2] {rowItem1, rowItem2};
newMultiEditorRow.PropertiesCollection.AddRange(rowItems);

// appending the multi-editor row to a collection of top level grid rows
vGridControl1.Rows.Add(newMultiEditorRow);
See Also