Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
885
Detecting column resize on mouseup event
posted

Hi, based on your sample I am using grid mouseup event to open another dialog by clicking on grid column header, however i don't like column resize effecting same code. Any way to prevent this?

Thanks!

 

Current Code:

Private Sub Grid1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Grid1.MouseUp

Dim mouseupUIElement As UIElement = Grid1.DisplayLayout.UIElement.ElementFromPoint(New Point(e.X, e.Y))

Dim mouseupColumn As UltraGridColumn

Dim mouseupRow As UltraGridRow

Try

' retrieve the Column from the UIElement

mouseupColumn = mouseupUIElement.GetContext(GetType(UltraGridColumn))

' retrieve the Row from the UIElement, important to prevent pop-up on non header click

mouseupRow = mouseupUIElement.GetContext(GetType(UltraGridRow))

Catch

End Try

If Not mouseupColumn Is Nothing AndAlso mouseupRow Is Nothing Then

    Select Case mouseupColumn.Key

          Case "Blah"

                      Dim objFrm As New Form3

                      objFrm.ShowDialog(Me)

    End Select

End If

End Sub

 

 

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    Hi,

    If you want to detect when the mouse is on the edge of a column you can check for an AdjustableUIElement. Try calling AdjustableElementFromPoint first, before you call ElementFromPoint. If AdjustableElementFromPoint returns null, continue with your existing code. If it does not return null, it means the mouse is currently over a resizing point and you should bail out. 

Children