Imports Infragistics.Win
Imports System.Drawing
Imports System.Diagnostics
Public Function GetRowCellCount(ByVal pt As Point) As Integer
' Determine if we clicked on a row, first get the element under the mouse.
Dim elementUnderMouse As UIElement
elementUnderMouse = Me.UltraGrid1.DisplayLayout.UIElement.ElementFromPoint(pt)
If Not elementUnderMouse Is Nothing Then
Dim elementRow As UIElement
elementRow = elementUnderMouse.GetAncestor(GetType(UltraWinGrid.RowUIElement))
If Not elementRow Is Nothing Then
' You now have the row element to do with as you please.
' Get the count of the cells collection
Dim row As UltraWinGrid.UltraGridRow = elementRow.GetContext(GetType(UltraWinGrid.UltraGridRow))
If Not row Is Nothing Then
Debug.WriteLine(row.Cells.Count.ToString())
Return row.Cells.Count
End If
End If
End If
Return 0
End Function