Infragistics(R) NetAdvantage(R) Windows Forms
VisibleRow Class
Members  Example  See Also  E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace : VisibleRow Class

This class reperesents an instance of a Row within a specific RowScrollRegion

Syntax

Visual Basic (Declaration) 
Public Class VisibleRow 
   Inherits Infragistics.Shared.SubObjectBase
C# 
public class VisibleRow : Infragistics.Shared.SubObjectBase 

Example

Following code shows some of the information available in AfterRowRegionScroll event and what they could be potentially used for. It prints out the number of rows that are partially or fully visible after the rows have been scrolled.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Visual BasicCopy Code
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Imports System.Diagnostics

   Private Sub UltraGrid1_AfterRowRegionScroll(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.RowScrollRegionEventArgs) Handles ultraGrid1.AfterRowRegionScroll

       ' AfterRowRegionScroll gets fired after rows are scrolled in a row scroll region.
       ' VisibleRows off the RowScrollRegion has the list of rows that would be visible.
       ' (Without taking into consideration the clipping that would occur if a band was
       ' horizontally scrolled out of view. The rows would stil be in the visible rows 
       ' collection, however they will not have an associated ui element). Also, the last
       ' row may not be visible at all. For convenience, the UltraGrid adds an extra
       ' visible row to the VisibleRows collection. This extra row will not be visible
       ' unless absolute last row has been scrolled into view.

       ' Following code prints out the number of visible rows.
       Dim visibleRowCount As Integer = 0

       Dim i As Integer
       For i = 0 To e.RowScrollRegion.VisibleRows.Count - 1
           Dim vr As VisibleRow = e.RowScrollRegion.VisibleRows(i)

           Dim row As UltraGridRow = vr.Row

           ' If the row is visible, then increment the counter.
           If Not Nothing Is row AndAlso Not Nothing Is row.GetUIElement(e.RowScrollRegion) Then
               visibleRowCount += 1
           End If
       Next

       Debug.WriteLine("Number of visible rows = " & visibleRowCount.ToString())

   End Sub
C#Copy Code
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void ultraGrid1_AfterRowRegionScroll(object sender, Infragistics.Win.UltraWinGrid.RowScrollRegionEventArgs e)
{

	// AfterRowRegionScroll gets fired after rows are scrolled in a row scroll region.
	// VisibleRows off the RowScrollRegion has the list of rows that would be visible.
	// (Without taking into consideration the clipping that would occur if a band was
	// horizontally scrolled out of view. The rows would stil be in the visible rows 
	// collection, however they will not have an associated ui element). Also, the last
	// row may not be visible at all. For convenience, the UltraGrid adds an extra
	// visible row to the VisibleRows collection. This extra row will not be visible
	// unless absolute last row has been scrolled into view.

	// Following code prints out the number of visible rows.
	int visibleRowCount = 0;

	for ( int i = 0; i < e.RowScrollRegion.VisibleRows.Count; i++ )
	{
		VisibleRow vr = e.RowScrollRegion.VisibleRows[i];

		UltraGridRow row = vr.Row;

		// If the row is visible, then increment the counter.
		if ( null != row && null != row.GetUIElement( e.RowScrollRegion ) )
			visibleRowCount++;
	}

	Debug.WriteLine( "Number of visible rows = " + visibleRowCount.ToString( ) );

}

See Also