MultiEditorRowPropertiesCollection.Remove(Object) Method

Removes a specific row item object from the MultiEditorRow.PropertiesCollection.

Namespace: DevExpress.XtraVerticalGrid.Rows

Assembly: DevExpress.XtraVerticalGrid.v20.1.dll

Declaration

public void Remove(
    object rowProperties
)
Public Sub Remove(
    rowProperties As Object
)

Parameters

Name Type Description
rowProperties Object

An object representing the row item to remove from the row item collection.

Remarks

Use the Remove method to remove a specific row item representing an individual row properties object for a multi-editor row from the row's MultiEditorRow.PropertiesCollection.

This method performs a linear search. So, the average execution time is proportional to the MultiEditorRowPropertiesCollection.Count. The elements that follow the removed element move up to occupy the vacated area. The indexes of the moved elements are updated.

Note that the VGridControlBase.RowChanged event occurs each time after a row item is successfully removed from the collection. The event parameter's RowChangedEventArgs.ChangeType property representing the type of row processing performed returns the RowChangeTypeEnum.PropertiesDeleted value.

If you wish to remove a row item specified by its index in the collection, use the MultiEditorRowPropertiesCollection.RemoveAt method. You can use the MultiEditorRowPropertiesCollection.Clear method to remove all row items from the collection.

You can use the MultiEditorRowPropertiesCollection.Add method to add new row item objects to the collection. Existing row items can be added to the collection with the help of the MultiEditorRowPropertiesCollection.AddRange method.

Examples

The following example represents a function that tries to remove a row item, the row item is specified by a field name passed as a string which is obtained from the MultiEditorRow.PropertiesCollection of a multi-editor row. The multi-editor row is passed via the row parameter.

The function code demonstrates how to use the MultiEditorRowPropertiesCollection.Item property and MultiEditorRowPropertiesCollection.Contains and MultiEditorRowPropertiesCollection.Remove methods to perform the task mentioned.

private bool RemoveRowItem(BaseRow row, string fieldName) {
    // checking whether the passed row is of the multi editor type
    if (row.XtraRowTypeID != 3) return false;
    MultiEditorRowPropertiesCollection propsCollection = 
      (row as MultiEditorRow).PropertiesCollection;

    // checking whether the collection of row items is not empty and 
    // the passed field name is not an empty string
    if (propsCollection.Count == 0 | fieldName == "") return false;

    // checking whether the collection contains the specified row item
    if (propsCollection.Contains(propsCollection[fieldName])) {
        // removing the specified row item from the collection
        propsCollection.Remove(propsCollection[fieldName]);
        return true;
    }
    else
        return false;
}

Implements

See Also