Hi,
As I understood that you want to know whether the user clicked on the column header or not? If this is correct, You can use the below code to detect whether the user clicks on the column header or not. If I misunderstood your scenario please elaborate your question so that I can help.
Dim ugColl As UltraGridColumn = uiElement.GetContext(GetType(UltraGridColumn))
If (ugCell Is Nothing And ugColl IsNot Nothing) Then
' your code goes here
End If
[quote user="dpbouchard"]
I would like to know if I right-clicked on the cell header. How do I do this?
My current code:
Private Sub ugCommission_MouseUp(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles ugCommission.MouseUp
Dim cmItemNum As New ContextMenuStrip
Dim cmCommDue As New ContextMenuStrip
If e.Button = Windows.Forms.MouseButtons.Right Then
Dim ptCurrent As Point = New Point(e.X, e.Y)
Dim uiElement As Infragistics.Win.UIElement = CType(sender, UltraGrid).DisplayLayout.UIElement.ElementFromPoint(ptCurrent)
Dim ugCell As UltraGridCell = uiElement.GetContext(GetType(UltraGridCell))
Dim ugRow As UltraGridRow = uiElement.GetContext(GetType(UltraGridRow))
' Thought ugUIElement would be it, but it is also nothing when I right click on the col header cell
Dim ugUIElement As UltraGridUIElement = uiElement.GetContext(GetType(UltraGridUIElement))
If ugCell IsNot Nothing Then
ugCommission.Selected.Rows.Clear()
ugRow.Selected = True
If ugCell.Column.Key = "ITEM_NUM" Then
_cmItemNum.Show(ugCommission, ptCurrent)
ElseIf ugCell.Column.Key = "COMM_DUE" Then
_cmCommDue.Show(ugCommission, ptCurrent)
End If
End If
End If
End Sub
[/quote]