Skip to main content

MultiEditorRowPropertiesCollection.Count Property

Gets the actual number of row items contained within the MultiEditorRow.PropertiesCollection.

Namespace: DevExpress.XtraVerticalGrid.Rows

Assembly: DevExpress.XtraVerticalGrid.v23.2.dll

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

Declaration

public int Count { get; }

Property Value

Type Description
Int32

An integer value representing the number of row items in the row item collection.

Remarks

This property enables you to determine the number of row items represented by row properties objects in the MultiEditorRow.PropertiesCollection collection. The Count property is used when traversing through the collection to determine its upper bound. Since the collection has a zero-based index, the index of the last element is one less than the Count property value.

Note that this property is automatically set to 0 after the MultiEditorRowPropertiesCollection.Clear method of the collection is called.

Example

The example below represents a procedure which uses the MultiEditorRowPropertiesCollection.Count and MultiEditorRowPropertiesCollection.Item properties to loop through all the row items of a multi-editor row passed as a parameter and create the corresponding items in a listView control. This example assumes that the form already contains a VGridControl and ListView controls named vGridControl1 and listView1 relatively.

Each newly created ListView item displays the caption and image of the corresponding row item from the MultiEditorRow.PropertiesCollection of the processed multi-editor row.

private void PopulateListView(BaseRow row) {
    // checking whether the passed row is of the multi editor type
    if (row.XtraRowTypeID != 2) return;
    MultiEditorRowPropertiesCollection propsCollection = 
      (row as MultiEditorRow).PropertiesCollection;

    // checking whether the collection of row items is not empty
    if (propsCollection.Count == 0) return;
    listView1.SmallImageList = vGridControl1.ImageList;

    // iterating through the collection of row items and 
    // creating the corresponding items in the list view control
    for (int i=0; i < propsCollection.Count; i++) {
        MultiEditorRowProperties props = propsCollection[i];
        listView1.Items.Add(props.Caption, props.ImageIndex);
    }
}
See Also