I'm trying to determine which GalleryToolItem the mouse is hovering over from the ToolBarsManager MouseEnterEvent. I've been able to get to the UIElement that is Infragistics.Win.UltraWinToolbars.PopupGalleryItemUIElement and its cooresponding System.Drawing.Point but I don't see any methods for determining the galleryToolItem from that information.
Is there a better way to find the item or am I missing something?
Thanks,
JL
Mike,
Thanks for the info. The Cursor.Position seems to be working fine in this case, but this is definitely good information to know. I'm sure I'll find a use for it.
Thanks!
Jim
If you have the item's UIElement, you can ask for it's Control property. The Rect of the element is always in client coordinates of this Control. Then you can just get the Form of the Control and add the Control's location relative to the Form to the element Rect's Location relative to the Control.
Mark,
Thanks for the reply. However, the problem was that I had the item, but couldn't get its position in relation to the form.
After getting your reply, I went back and worked on this some more and was able to position the tooltip using the System.Windows.Forms.Cursor.Position x and y coordinates.
Here is the same code in C#, if you prefer that:
I hope this helps:
Private Function GetGalleryToolItemFromScreenPoint(ByVal myToolbar As UltraToolbarsManager, ByVal myGallery As PopupGalleryTool, _
ByVal myGroup As GalleryToolItemGroup, ByVal screenPoint As Point) As GalleryToolItem
Dim myElement As UIElement = myToolbar.UIElementFromPoint(screenPoint)
For Each myItem As GalleryToolItem In myGallery.Items
Dim relatedUI As UIElement = myItem.GetUIElement(myGallery, myGroup, GalleryArea.Preview)
If relatedUI IsNot Nothing Then
If myElement.IsDescendantOf(relatedUI) Then
Return myItem '* This GalleryToolItem relates to this UI Element.
End If
Next
Return Nothing '* The item was not found.
End Function