Imports Infragistics.Win
Imports Infragistics.Win.UltraWinListView
Private Function ColumnFromPoint(ByVal listView As UltraListView, ByVal point As Point) As UltraListViewColumnBase
If listView Is Nothing Or listView.UIElement Is Nothing Then Return Nothing
' If there is an UltraListViewSubItem at the specified point,
' return a reference to its Column property
Dim subItem As UltraListViewSubItem = listView.SubItemFromPoint(point)
If Not subItem Is Nothing Then Return subItem.Column
' Try to find an UltraListViewColumnHeaderUIElement if we do,
' return a reference to its Column property
Dim elementAtPoint As UIElement = listView.UIElement.ElementFromPoint(point)
Dim headerElement As UltraListViewColumnHeaderUIElement = Nothing
While (Not elementAtPoint Is Nothing)
If elementAtPoint.GetType() Is GetType(UltraListViewColumnHeaderUIElement) Then
headerElement = CType(elementAtPoint, UltraListViewColumnHeaderUIElement)
Return headerElement.Column
End If
elementAtPoint = elementAtPoint.Parent
End While
Return Nothing
End Function