Back to Devexpress

RowOperation.NeedsFullIteration Property

windowsforms-devexpress-dot-xtraverticalgrid-dot-rows-dot-rowoperation.md

latest4.4 KB
Original Source

RowOperation.NeedsFullIteration Property

Gets a value indicating whether all rows or only parent rows are processed.

Namespace : DevExpress.XtraVerticalGrid.Rows

Assembly : DevExpress.XtraVerticalGrid.v25.2.dll

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

Declaration

csharp
public virtual bool NeedsFullIteration { get; }
vb
Public Overridable ReadOnly Property NeedsFullIteration As Boolean

Property Value

TypeDescription
Boolean

true if all rows must be processed by the operation; false if only rows that have children are to be processed.

|

Remarks

As implemented in the RowOperation class, the NeedsFullIteration property is set to true. This implies that all rows are processed by the iterator. However there may be situations when you need to traverse through parent rows only. In this case you must set the NeedsFullIteration property to false in your operation class in order to omit rows that don’t have children. An example could be if you were using the iterator to expand or collapse all rows within a vertical grid control.

Note : rows for which the RowOperation.NeedsVisitChildren method returns false are omitted regardless of the NeedsFullIteration property value.

Example

The following sample code demonstrates how to create an operation class that will collapse all rows that do not contain a specified row as their child. Thus, only the parent rows of the specified one will be expanded as a result.

The RowOperation.Execute method checks whether the processed row contains the specified row as a child. If not, the processed row is collapsed. The operation class also overrides the RowOperation.NeedsFullIteration property so as to process only parent rows.

csharp
public class CollapseExceptSpecifiedOperation : RowOperation {
   BaseRow visibleRow;
   public CollapseExceptSpecifiedOperation(BaseRow visibleRow) : base() {
      this.visibleRow = visibleRow;
   }
   public override void Execute(BaseRow row) {
      if (!row.HasAsChild(visibleRow))
         row.Expanded = false;
   }
   public override bool NeedsFullIteration { get { return false; } }
}
// ...
// collapsing all rows that do not contain the focused row as a child
vGridControl1.RowsIterator.DoOperation(
  new CollapseExceptSpecifiedOperation(vGridControl1.FocusedRow));
vb
Public Class CollapseExceptSpecifiedOperation
   Inherits RowOperation
   Dim visibleRow As BaseRow
   Public Sub New(ByVal visibleRow As BaseRow)
      Me.visibleRow = visibleRow
   End Sub
   Public Overrides Sub Execute(ByVal row As BaseRow)
      If Not row.HasAsChild(visibleRow) Then
         row.Expanded = False
      End If
   End Sub
   Public Overrides ReadOnly Property NeedsFullIteration() As Boolean
      Get
         Return False
      End Get
   End Property
End Class
' ...
' collapsing all rows that do not contain the focused row as a child
vGridControl1.RowsIterator.DoOperation( _
  New CollapseExceptSpecifiedOperation(vGridControl1.FocusedRow))

See Also

NeedsVisitChildren(BaseRow)

Tree Traversal

RowOperation Class

RowOperation Members

DevExpress.XtraVerticalGrid.Rows Namespace