Skip to main content

Assigning Editors to Multi-Editor Rows

  • 3 minutes to read

The difference between a multi-editor row and an editor row is that a multi-editor row displays data from several fields. Field values are displayed in separate cells combined in a single column, and each cell uses its own editor to present and edit underlying data.

Displaying the values of several data fields within a single row implies that the row contains a collection of row properties. Thus, assigning editors to multi-editor rows is the same as assigning editors to editor rows - the only difference is that editors are bound to each item in the row properties collection. This collection can be accessed via the MultiEditorRow.PropertiesCollection property.

Assigning Editors at Design Time

As mentioned earlier, assigning editors to multi-editor rows is similar to assigning them to editor rows. The only difference is that you need to access a specific item within the row properties collection.

This example will create a spin editor and bind it to two items in a multi-editor row. The image below shows a VGridControl before the editors have been assigned.

AssignEditorsM - Start

Follow the steps below.

  1. Right-click the vertical grid control and select Run Designer from the context menu.

    Concepts - EditorsForMultiRows - 1

  2. In the invoked VerticalGrid Designer, select the target multi-editor row and switch to the Row Properties tab.

    Concepts - EditorsForMultiRows - 1-2

  3. In the MPG City tab (which displays the settings of the first row item), select the RowEdit property, click the dropdown button and select the SpinEdit item in the dropdown window.

    Concepts - EditorsForMultiRows - 2

    The assigned repository item is automatically added to the control’s internal repository.

  4. Switch to the Highway tab (which displays the settings of the second row item) and assign the previously created spin editor to it via the RowEdit property.

    Concepts - EditorsForMultiRows - 3

  5. Run the application. The image below shows the result of assigning the editors.

    AssignEditorsM - Result

In the image above, editor buttons are displayed for all cells within the currently focused row. This effect can be achieved by setting the VGridControlBase.ShowButtonMode property to ShowButtonModeEnum.ShowForFocusedRow.

Assigning Editors at Runtime

The sample code below performs the same actions as in the design-time example.

using DevExpress.XtraVerticalGrid.Rows;
// ...
// Obtain the desired multi-editor row.
MultiEditorRow row = vGridControl1.Rows["multiEditorRow1"] as MultiEditorRow;
// Assign the newly created SpinEdit to the first row item.
row.PropertiesCollection["MPG City"].RowEdit = vGridControl1.RepositoryItems.Add("SpinEdit");
// Assign the same editor to the second row item.
row.PropertiesCollection["MPG Highway"].RowEdit = row.PropertiesCollection["MPG City"].RowEdit;
See Also