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
645
Suppress ToolTip when handling mouse enter event
posted

In this question: http://forums.infragistics.com/forums/t/49255.aspx Graham provided a good solution to the situation where points overlapped on a mouse click by popping up a control to display the points.

Now, looking a bit further at the situation, I'd like to perform the same sort of thing when doing a mouseover on the series. To handle this, I handled the series MouseEnter event, grabbed the current mouse position, computed the X and Y offset of the series, adjusted the mouse position for that offset and used that position to determine what points were under the mouse (or close to it). Something like this:

Point point = Mouse.GetPosition(xamDataChart1);

double diffW = xamDataChart1.ActualWidth - e.Series.ActualWidth;

double diffH = xamDataChart1.ActualHeight - e.Series.ActualHeight;

point.X = point.X - diffW;

point.Y = point.Y - diffH;

// basically do GetHitHitems except pass in point rather than e.Item.

This works swimmingly well except that sometimes I get the ToolTip for one of the overlapping points popping up rather than my own Popup listing the points.

Any ideas how to avoid this happening? 

 

Parents
  • 30692
    Verified Answer
    Offline posted

    Are you setting the tooltip property on the series? If you are doing your own tooltip handling you should perhaps not set our tooltip property, so that it doesnt pop up at inappropriate times. Maybe I'm misunderstanding though. Also, if you want to prevent containing controls from getting an event that you want to handle yourself you should set e.Handled = true. Which will prevent the event from propagating higher. Depending on what you are doing though, this could interfere with other features of the control.

    -Graham

Reply Children
No Data