Version

GetUIElement(RowScrollRegion,ColScrollRegion,Boolean) Method

Returns the UltraGridUIElement object that is associated with an object.
Syntax
'Declaration
 
Public Overloads Overrides Function GetUIElement( _
   ByVal rsr As RowScrollRegion, _
   ByVal csr As ColScrollRegion, _
   ByVal verifyElements As Boolean _
) As Infragistics.Win.UIElement
public override Infragistics.Win.UIElement GetUIElement( 
   RowScrollRegion rsr,
   ColScrollRegion csr,
   bool verifyElements
)

Parameters

rsr
The RowScrollRegion
csr
The ColScrollRegion
verifyElements
Indicates whether to VerifyChildElements

Return Value

The UIElement associated with the object, in the specified row and column scrolling regions.
Remarks

Invoke this method to return a reference to an object's UIElement. The reference can be used to set properties of, and invoke methods on, the UIElement object associated with an object. You can use this reference to access any of the UIElement's properties or methods.

The Type property can be used to determine what type of UIElement was returned. If no UIElement exists, meaning the object is not displayed, Nothing is returned.

The ParentUIElement property can be used to return a reference to a UIElement's parent UIElement object. The UIElements property can be used to return a reference to a collection of child UIElement objects for a UIElement.

The UIElementFromPoint method can be invoked to return a reference to an UIElement object residing at specific coordinates.

CanResolveUIElement method can be invoked to determine whether an object or one of its ancestors can be resolved as a specific type of UIElement.

The GetUIElement method does not take into account the presence of a pop-up edit window or the drop-down portion of a combo if these elements are present, and will never return a UIElement that corresponds to one of these elements. The GetUIElementPopup method can be invoked to return a reference to a popup window's UIElement.

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