Returns or sets the active RowScrollRegion object. This property is not available at design-time.
Following code shows you how to get the location of a cell, in this case the active cell.
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Imports System.Diagnostics
Private Sub Button56_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button56.Click
' Get the cell you want to get the location of.
Dim cell As UltraGridCell = Me.UltraGrid1.ActiveCell
If Not Nothing Is cell Then
' If there are multiple scroll regions, then we have to specify which scroll region to
' get the ui element in. A cell could be visible in multiple places if you had split the
' grid in two or more scroll regions. Intersection of ActiveRowScrollRegion and the
' ActiveColScrollRegion make up the active scroll region which is where the edit control
' would be positioned by the UltraGrid for editing the cell's contents if the cell were
' in edit mode.
Dim rsr As RowScrollRegion = Me.ultraGrid1.ActiveRowScrollRegion
Dim csr As ColScrollRegion = Me.ultraGrid1.ActiveColScrollRegion
Dim contexts As Object() = New Object() {rsr, csr, cell}
' Get the ui element associated with the cell.
Dim cellElem As CellUIElement = DirectCast(Me.ultraGrid1.DisplayLayout.UIElement.GetDescendant(GetType(CellUIElement), contexts), CellUIElement)
If Not Nothing Is cellElem Then
' Write out the cell's location in the UltraGrid.
Dim cellBounds As Rectangle = cellElem.Rect
Debug.WriteLine("Cell's bounds in the UltraGrid are " & cellBounds.ToString())
Else
' If there is no ui element associated with the cell, then the cell is not visible.
Debug.WriteLine("Cell is not visible in the UltraGrid.")
End If
Else
Debug.WriteLine("There is no active cell.")
End If
End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;
private void button56_Click(object sender, System.EventArgs e)
{
// Get the cell you want to get the location of.
UltraGridCell cell = this.ultraGrid1.ActiveCell;
if ( null != cell )
{
// If there are multiple scroll regions, then we have to specify which scroll region to
// get the ui element in. A cell could be visible in multiple places if you had split the
// grid in two or more scroll regions. Intersection of ActiveRowScrollRegion and the
// ActiveColScrollRegion make up the active scroll region which is where the edit control
// would be positioned by the UltraGrid for editing the cell's contents if the cell were
// in edit mode.
RowScrollRegion rsr = this.ultraGrid1.ActiveRowScrollRegion;
ColScrollRegion csr = this.ultraGrid1.ActiveColScrollRegion;
object[] contexts = new object[] { rsr, csr, cell };
// Get the ui element associated with the cell.
CellUIElement cellElem = (CellUIElement)this.ultraGrid1.DisplayLayout.UIElement.GetDescendant( typeof( CellUIElement ), contexts );
if ( null != cellElem )
{
// Write out the cell's location in the UltraGrid.
Rectangle cellBounds = cellElem.Rect;
Debug.WriteLine( "Cell's bounds in the UltraGrid are " + cellBounds.ToString( ) );
}
else
{
// If there is no ui element associated with the cell, then the cell is not visible.
Debug.WriteLine( "Cell is not visible in the UltraGrid." );
}
}
else
{
Debug.WriteLine( "There is no active cell." );
}
}
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