Skip to main content

MultiEditorRowProperties() Constructor

Cteates a new MultiEditorRowProperties object with default settings.

Namespace: DevExpress.XtraVerticalGrid.Rows

Assembly: DevExpress.XtraVerticalGrid.v23.2.dll

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

Declaration

public MultiEditorRowProperties()

Remarks

You can use this constructor to create a new item representing an individual row properties object for a multi-editor row at runtime. The constructor initializes a new row item with the default settings. If you need a new row item to be created bound to a specific data field, you should use the constructor with the fieldName parameter.

You can use the methods and properties of the newly created row item object to adjust it as your application needs dictate: you can bind it to a data field, specify its caption, editor type, etc.

In order to be displayed, the created row item should be added to the row item collection of a multi-editor row. The row item collection is accessed via the MultiEditorRow.PropertiesCollection property and is represented by the MultiEditorRowPropertiesCollection class. This class provides methods to manipulate row items within the collection. The only way to add row items created programmatically to the MultiEditorRow.PropertiesCollection is to use the MultiEditorRowPropertiesCollection.AddRange method. Note that this method accepts an array of MultiEditorRowProperties objects. So you should create an array of existing row items and pass this array to the method as the props parameter.

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