MultiEditorRowProperties(String) Constructor

Creates a new MultiEditorRowProperties object and binds it to the specified data field.

Namespace: DevExpress.XtraVerticalGrid.Rows

Assembly: DevExpress.XtraVerticalGrid.v20.2.dll

Declaration

public MultiEditorRowProperties(
    string fFieldName
)
Public Sub New(
    fFieldName As String
)

Parameters

Name Type Description
fFieldName String

A string value specifying the name of the data field to which the created row item should be bound. This value is assigned to the RowProperties.FieldName property.

Remarks

You can use this constructor to programmatically create a new item representing an individual row properties object bound to a specific data field. The constructor initializes the RowProperties.FieldName property with the parameter value. Other properties are set to their default values. If you need a new row item to be created with the default settings, you should use the constructor with no parameters.

You can use methods and properties of the newly created row item object to adjust it as your application needs dictate: you can 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.

Examples

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