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

RowOperation.NeedsVisitChildren(BaseRow) Method

Returns a value specifying whether the operation is performed on the specified row’s children.

Namespace: DevExpress.XtraVerticalGrid.Rows

Assembly: DevExpress.XtraVerticalGrid.v19.1.dll

Declaration

public virtual bool NeedsVisitChildren(
    BaseRow row
)

Parameters

Name Type Description
row BaseRow

A BaseRow descendant representing the processed row whose child rows are to be visited.

Returns

Type Description
Boolean

true if the operation must be performed on the specified row’s children; otherwise, false.

Example

This sample demonstrates how to obtain the collection of rows residing at a specific level and prevent them from being resized. For this purpose, the operation class declares a local variable storing the level index. This variable is initialized in the constructor. If a row that belongs to the specified level is found, it is added to the internal rows collection. The operation class also declares a public property that allows access to the collection of obtained rows.

The operation class introduced in the sample overrides the RowOperation.NeedsVisitChildren method of its base class. This is used to prohibit visiting rows whose nesting level is greater than that specified, improving performance.

public class GetRowsAtLevelOperation : RowOperation {
   int level;
   ArrayList rows;
   public GetRowsAtLevelOperation(int level) : base() {
      this.level = level;
      rows = new ArrayList();
   }
   public override void Execute(BaseRow row) {
      if (row.Level == level)
         rows.Add(row);
   }
   public override bool NeedsVisitChildren(BaseRow row) {
      if (row.Level == level) 
         return false;
      return true;
   }
   public ArrayList Rows { get { return rows; } }
}
// ...
// Prevent rows at the second nesting level from being resized
GetRowsAtLevelOperation operation = new GetRowsAtLevelOperation(1);
vGridControl1.RowsIterator.DoOperation(operation);
foreach (object rowObject in operation.Rows) {
   BaseRow row = rowObject as BaseRow;
   row.OptionsRow.AllowSize = false;
}
See Also