windowsforms-devexpress-dot-xtraverticalgrid-dot-rows-dot-multieditorrowpropertiescollection-8b483d51.md
Gets the actual number of row items contained within the MultiEditorRow.PropertiesCollection.
Namespace : DevExpress.XtraVerticalGrid.Rows
Assembly : DevExpress.XtraVerticalGrid.v25.2.dll
NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid
public int Count { get; }
Public ReadOnly Property Count As Integer
| Type | Description |
|---|---|
| Int32 |
An integer value representing the number of row items in the row item collection.
|
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.
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);
}
}
Private Sub PopulateListView(ByVal Row As BaseRow)
' checking whether the passed row is of the multi editor type
If Row.XtraRowTypeID <> 2 Then Return
Dim PropsCollection As MultiEditorRowPropertiesCollection = CType(Row, _
MultiEditorRow).PropertiesCollection
' checking whether the collection of row items is not empty
If PropsCollection.Count = 0 Then Return
ListView1.SmallImageList = VGridControl1.ImageList
Dim I As Integer
' iterating through the collection of row items and
' creating the corresponding items in the list view control
For I = 0 To PropsCollection.Count - 1
Dim Props As MultiEditorRowProperties = PropsCollection(I)
ListView1.Items.Add(Props.Caption, Props.ImageIndex)
Next
End Sub
See Also
MultiEditorRowPropertiesCollection Class