I want to get the currently selected data Point for the currently selected item in a callout layer.
I have found that for a series with markes this can be done with:
----------
void xamdatachart_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) { // throw new NotImplementedException(); Marker marker = Utilities.GetAncestorFromType(e.OriginalSource as DependencyObject, typeof(Marker), false) as Marker; if (marker != null)
........
How can I get the Point related to the current CalloutLayer selection?
Regards Horst
Meanwhile I found a solution which might be interesing for other users...
/// <summary> /// Search peak selected and highlight /// </summary> private void Maxima_MouseEnter(object sender, MouseEventArgs e) { CalloutLayer callout = sender as CalloutLayer; Border selected = null; foreach (UIElement element in callout.RootCanvas.Children) // search canvas for border element containing the callout text { if (element is Grid) { Grid grid = element as Grid; foreach(UIElement uI in grid.Children) { if (uI is Border) { Border border = uI as Border; if (border.IsMouseOver) { selected = border; break; } } } } } if (selected != null) { DataContext context = selected.DataContext as DataContext; // get the selected item from data context if (context != null) { MovablePoint movable = context.Item as MovablePoint; if (movable != null) { ... } } } e.Handled = true; }
Hello Mike,
I should have been more verbose...
The example above was from a previous post in this Forum. I my current Project I already implemented handlers for the CalloutLayer Events not the Chart.
The Problem I have is that I want to Highlight a range of the graph
similar to the above Picture. But also by entering the Callout at top of the Peak. This should be done inside the MouseEnter Event. But the Sender of this Event is the CalloutLayer and the MouseEventArgs Source and OriginalSource also give only the callout layer.
While the MouseLeftButtonDown gives the Callout Border as OriginalSource.
How do I get the Data Item related to the Callout entered with the mouse?
Hello Horst,
Thank you for contacting Infragistics!
Instead of the mouse event on the chart itself you will want to try the mouse events on the series, that will have more information about the data than the mouse events for the whole chart.