We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

MouseEnter event for annotation isn't working

Hi, I can't get the MouseEnter event to fire for an EllipseAnnotation.

Attached is a sample. Run the sample and click the red circle. A popup is displayed with two hyperlinks. What I want is that the popup is displayed when the mouse is hovering over the annotation (via the MouseEnter event) instead. How can this be achieved?

Thank you.

Attachment: sfChartCrossHair_b54617e3.rar

3 Replies

MK Muneesh Kumar G Syncfusion Team November 21, 2018 09:27 AM UTC

Hi Tom, 
 
Greetings from Syncfusion, we have analyzed your query and we would like to inform you that we have drawn annotation rendering element using separate shape. So, we have raised below mouse events manually for annotation shape in our source.  
 
1.       MouseRightButtonDown 
2.       MouseRightButtonUp 
3.       MouseUp 
4.       MouseDown 
5.       MouseMove 
6.       MouseLeftButtonDown 
7.       MouseLeftButtonUp 
8.       MouseLeave 
 
Except these events you have to raise other events manually as per the below code snippet.  
 
Code snippet 
Protected Overrides Function ArrangeOverride(finalSize As Size) As Size 
 
        AddHandler AnnotationElement.MouseEnter, AddressOf MouseEnter 
 
        Return MyBase.ArrangeOverride(finalSize) 
    End Function 
 
    Private Sub MouseEnter(sender As Object, e As MouseEventArgs) 
        Console.WriteLine("OnMouseEnter") 
 
        'SET POSITION 
        Dim pt As Point = e.GetPosition(CType(MainWindow.gMain, UIElement)) 
        MainWindow.AnnotationPopup.Placement = Primitives.PlacementMode.RelativePoint 
       .. 
 
        MainWindow.AnnotationPopup.IsOpen = True 
    End Sub 
 
 
    Private Sub CustomEllipseAnnotation_MouseLeave(sender As Object, e As MouseEventArgs) Handles Me.MouseLeave 
        Console.WriteLine("CustomEllipseAnnotation_MouseLeave") 
 
        MainWindow.AnnotationPopup.sp.Children.Clear() 
        MainWindow.AnnotationPopup.IsOpen = False 
 
    End Sub 
 
We have modified your sample based on this, now the sample works fine as per your expect. Please find the sample from the following location.  
 
 
Hope it helps.  
 
Regards, 
Muneesh Kumar G.  
 



TO Tom November 21, 2018 10:30 AM UTC

Brilliant, Muneesh, thank you so much. Now the MouseEnter event for the annotation works. Just a minor detail, I had to move the MouseLeave handling code over to the MouseLeave event of the Popup instead to solve the flickering issue. Now, there are no problems.


MK Muneesh Kumar G Syncfusion Team November 21, 2018 11:30 AM UTC

Hi Tom,  
  
Thanks for the update. 
  
We are glad to know that the given solution works. Please let us know if you need any further assistance. 
 
Regards, 
Muneesh Kumar G.  
 


Loader.
Live Chat Icon For mobile
Up arrow icon