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
515
Row Selector Click / Own Column
posted

Hi Guys

I am having some troubles isolating the click event of the row selectors, mainly because I use RowSelectorNumberStyle.RowIndex, and the row index is a text element...

I have used a DrawFilter to remove the selector arrows.

I have already trapped the column header click with no problems using the following code on mouse down:

Dim ThisUIElement As UIElement
Dim ThisHeader As ColumnHeader

ThisUIElement = Grid.DisplayLayout.UIElement.ElementFromPoint(New Point(e.X, e.Y))
If Not ThisUIElement Is Nothing Then
    ThisHeader = ThisUIElement.GetContext(GetType(ColumnHeader))
    If Not ThisHeader Is Nothing Then
        *Code*
    End If
End If

This seems to pay no attention to whether I click the column header caption or not... Unfortunately, with the row selectors, clicking on the row index numbers makes the current UIElement a TextElement rather than RowSelectorUIElement

How can I isolate a click event on a row selector whether it is on the row index or not?

---------------------------------------------------------------------------- 
Also, is there any way to have the row selectors occupy their own column space, rather than overlap the first column in the grid?

 

Thanks in advance!

Parents
  • 469350
    Verified Answer
    Offline posted

    pkirsch said:
    How can I isolate a click event on a row selector whether it is on the row index or not?

     

    The GetAncestor method will be helpful here. What you can do is get the ElementFromPoint just as you are doing. Check the type of the element. If it's already a RowSelectorUIElement, then you're done. If not, then you can call GetAncestor on it and pass in GetType(RowSelectorUIElement). This will walk up the elements parent chain through all of i's containing elements and return any RowSelectorUIElement in the chain. If it returns one, you know it was a RowSelector. If not, it will return Nothing. 

    pkirsch said:
    Also, is there any way to have the row selectors occupy their own column space, rather than overlap the first column in the grid?

    I beleive you are looking for the RowSelectorHeaderStyle property. 

     

Reply Children
No Data