Version

AfterRowRegionScroll Event

Occurs after a row scrolling region is scrolled.
Syntax
'Declaration
 
Public Event AfterRowRegionScroll As RowScrollRegionEventHandler
public event RowScrollRegionEventHandler AfterRowRegionScroll
Event Data

The event handler receives an argument of type RowScrollRegionEventArgs containing data related to this event. The following RowScrollRegionEventArgs properties provide information specific to this event.

PropertyDescription
RowScrollRegion The row scroll region (read-only)
Remarks

The rowscrollregion argument returns a reference to a RowScrollRegion object that can be used to set properties of, and invoke methods on, the rowscrollregion that was scrolled. You can use this reference to access any of the returned rowscrollregion's properties or methods.

This event is generated after a rowscrollregion is scrolled, either programmatically, or by user interaction. A rowscrollregion can be scrolled programmatically by invoking its Scroll method.

The ScrollBar property of a scrolling region determines whether a scroll bar is displayed for that scrolling region.

The BeforeRowRegionScroll event, which occurs before a rowscrollregion is scrolled, is generated before this event.

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.

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
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( ) );

}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also