Skip to main content

MultiEditorRowProperties Class

Contains row item settings for a multi-editor row.

Namespace: DevExpress.XtraVerticalGrid.Rows

Assembly: DevExpress.XtraVerticalGrid.v24.1.dll

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

Declaration

public class MultiEditorRowProperties :
    RowProperties,
    IComponent,
    IDisposable

Remarks

Each row type has its own corresponding row item settings type. The MultiEditorRowProperties class is used to provide row item settings for multi editor type rows. Multi-editor rows are complex as they can consist of several row items, settings for a single row item are represented by MultiEditorRowProperties instances.

Being a direct descendant of the RowProperties class, the MultiEditorRowProperties class inherits its common row item settings. In addition, the MultiEditorRowProperties class introduces two more properties (MultiEditorRowProperties.Width and MultiEditorRowProperties.MinWidth) that affect setting the width for a header cell of a row item. These properties can be used to specify the widths of row items, if a multi-editor row contains more than one item.

Since multi-editor rows can contain several row items, they maintain a collection of row item settings. This collection can be accessed via the MultiEditorRow.PropertiesCollection property of a row.

The MultiEditorRow.PropertiesCollection is empty until you populate it with MultiEditorRowProperties class instances. For this purpose, you can use overloaded variants of the constructor implemented by the MultiEditorRowProperties class. The newly created row item settings object can then be arrayed and added to the MultiEditorRow.PropertiesCollection by the MultiEditorRowPropertiesCollection.AddRange method.

The number of elements in this collection specifies the number of row items within a row (the number of data cells displayed within each record and the number of header cells). You can access a particular row item settings object from the collection by using the collection’s MultiEditorRowPropertiesCollection.Item property.

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);

Inheritance

Object
RowProperties
MultiEditorRowProperties
See Also