Skip to main content
A newer version of this page is available. .

BaseRow.GetRowProperties(Int32) Method

Returns an object containing type specific row settings.

Namespace: DevExpress.XtraVerticalGrid.Rows

Assembly: DevExpress.XtraVerticalGrid.v19.2.dll

Declaration

public RowProperties GetRowProperties(
    int index
)

Parameters

Name Type Description
index Int32

A zero-based integer value representing the index of the object that contains the row settings.

Returns

Type Description
RowProperties

A RowProperties object or its descendant that represents type specific row properties. null (Nothing in Visual Basic) if the index parameter value is negative or exceeds the maximum index available.

Remarks

The GetRowProperties method returns an object that contains row settings, specified by its index.

Multi-editor rows can maintain a collection of RowProperties derived objects. This collection is accessed via the row’s MultiEditorRow.PropertiesCollection property. Objects that contain row settings are stored as indexed items in the collection. Thus, you should specify a proper index when using the GetRowProperties method to gain access to the desired object.

The number of row items contained within a row can be obtained via the MultiEditorRowPropertiesCollection.Count property.

As for simple rows (category and editor rows) they refer to a single object representing specific row settings. So, to access these row settings use the BaseRow.Properties property. If you want to use the GetRowProperties method, a 0 value should be passed as the index parameter.

Example

The following sample code declares the FindRowItemByCaption method that searches the rows collection specified by the rows parameter for a row item with the specified caption. This method returns the first row item found.

The specified collection of rows and their children are traversed using the Rows Iterator‘s VGridRowsIterator.DoLocalOperation method. The operation performed on the row visited is specified by the FindRowItemOperation object. Once a row item with the specified caption is found, the operation’s RowOperation.CanContinueIteration property is automatically set to false. This indicates that the operation must be stopped. The operation’s RowProperties property represents the row item with the specified caption. null (Nothing in Visual Basic) is returned if no item is found.

using DevExpress.XtraVerticalGrid;
using DevExpress.XtraVerticalGrid.Rows;

// ...
RowProperties prop = FindRowItemByCaption(vGridControl1, vGridControl1.Rows, "Name");

// searches the specified rows collection for a row item with the specified caption
private RowProperties FindRowItemByCaption(VGridControl vGrid, VGridRows rows , 
string caption){
   FindRowItemOperation operation = new FindRowItemOperation(caption);
   vGrid.RowsIterator.DoLocalOperation(operation, rows);
   return operation.RowProperties;
}

// declares the operation calss
public class FindRowItemOperation : RowOperation {
   string caption;
   RowProperties props;

   public FindRowItemOperation(string caption) : base() {
      this.caption = caption;
      this.props = null;
   }

   public override void Execute(BaseRow row) {
      for(int i = 0; i < row.RowPropertiesCount; i++){
         if(row.GetRowProperties(i).Caption == caption) {
            props = row.GetRowProperties(i);
            return;
         }
      }
   }

   public override bool CanContinueIteration(BaseRow row) { 
      return (RowProperties == null); 
   }

   public RowProperties RowProperties {
      get {
         return props;
      }
   }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetRowProperties(Int32) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also