Is it possible to get the click event on a marker?

Mar 2, 2009 at 4:36 PM

I was wondering if there's a way to know if an element of the chart plotter (in my case, a LineGraph with only a CircleElementPointMarker) has been clicked by the user.
I don't think it's possible to manage events on items on the chart plotter, and only the chart plotter has click, mousedown etc. events... 
What should I do? The only idea so far is to get click event coordinates on chart plotter and transform the points of my datasource in the client coordinates to compare them. But even in this case I don't know how to get zoom and translation informations...

Continue the good work, DDD is really very good.

Thank you very much for your help

Mar 11, 2009 at 4:59 AM
Assuming you're using the source of DDD, you can change the top of the CircleElementPointMarkerClass.cs to look as follows

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Shapes;
using System.Windows.Input;

namespace Microsoft.Research.DynamicDataDisplay.PointMarkers
    /// <summary>Adds Circle element at every point of graph</summary>
 public class CircleElementPointMarker : ShapeElementPointMarker {

        public EventHandler<MouseButtonEventArgs> MarkerClick;

        public override UIElement CreateMarker()
            Ellipse result = new Ellipse();
            result.Width = Size;
            result.Height = Size;
            result.Stroke = Brush;
   result.Fill = Fill;

            result.MouseLeftButtonDown += new MouseButtonEventHandler(result_MouseLeftButtonDown);

            if (!String.IsNullOrEmpty(ToolTipText))
                ToolTip tt = new ToolTip();
                tt.Content = ToolTipText;
                result.ToolTip = tt;
            return result;

        void  result_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
            if (MarkerClick != null)
                MarkerClick(sender, e);



This gives you a MarkerClick event that you can then consume, somewhere else in your app. It's also useful to make the Markers Collection public in MarkerElementPointGraph.cs

        public ObservableCollection<UIElement> Markers
            get { return markers; }

Hope that helps, let me know how you go ...


Mar 11, 2009 at 12:19 PM
Thank you very much for your reply!

I'll give it a try soon and I'll let you know. In any case, I think it would be a nice addition for future releases of DDD.

Mar 12, 2009 at 6:54 PM
I tried and it works fine!!


Jun 24, 2009 at 3:08 PM


I have a similar requirement where i need to have clickable data point marker.

I tried the above code, but it does not work for me. And I am not able to grab click events on markets.

However when I remove mouseNavigation child element from chartPlotter.cs in the source code, I am able to get the click event on marker.

But I dont want to remove mouseNavigation from the charterPlot. 

Thanks for the help.