Creating Custom Markers

Mar 3, 2009 at 5:59 PM

   Thanks for the great component. I am trying to extend the existing StockMarket Example to show the complete OHLC values. For this I am hoping to develop a custom Marker to represent the stock info as a OHLC bar or as a candlestick. Can someone please point me in the right direction? I am reading the code now.

Mar 11, 2009 at 5:09 AM
I've been hacking around with DDD and created my own ControlPointMarker class

using System.Windows;
using System;
using System.Windows.Controls;

namespace Microsoft.Research.DynamicDataDisplay.PointMarkers
 /// <summary>Provides elements that represent markers along the graph</summary>
    public abstract class ControlPointMarker : ElementPointMarker
        /// <summary>Creates marker element at specified point</summary>
        /// <returns>UIElement representing marker</returns>
        public abstract override UIElement CreateMarker();
        public abstract Control CreateControlMarker();

        /// <summary>Moves specified marker so its center is located at specified screen point</summary>
        /// <param name="marker">UIElement created using CreateMarker</param>
        /// <param name="screenPoint">Point to center element around</param>
        public abstract void SetPosition(Control marker, Point screenPoint);

        public override void SetPosition(UIElement marker, Point screenPoint)
            Control controlMarker = marker as Control;

            if (marker == null) throw new ArgumentException("Expected a Control");
            this.SetPosition(controlMarker, screenPoint);

I've then subclassed from that to give me a Template that I can use

using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Controls;
using System.Windows.Input;

namespace Microsoft.Research.DynamicDataDisplay.PointMarkers
    //TODO re-write from ground up as proper control based marker
    /// <summary>Abstract class that extends ElementPointMarker and contains
    /// marker property as Pen, Brush and Size</summary>
 public abstract class VisualControlPointMarker : ControlPointMarker {

        public EventHandler<MouseEventArgs> MouseEnter;
        public EventHandler<MouseEventArgs> MouseLeave;
        public ControlTemplate Template
            get { return (ControlTemplate)GetValue(TemplateProperty); }
            set { SetValue(TemplateProperty, value); }

        public static readonly DependencyProperty TemplateProperty =

        public override Control CreateControlMarker()
            Control newMarker = (Control)CreateMarker();

            if (this.Template != null)
                newMarker.Template = this.Template;
            return (newMarker);

By applying the template, when you create the marker you can get it to look exactly how you want, and leverage the power of WPF. I'm not sure if this is the best approach, but it does work.

Mar 11, 2009 at 8:26 PM
Hmm.... That is interesting. What I actually wanted was to display something line the Open-High-Low-Close graphs that are shown for stock makets. In that case, the Marker shown for each point in time changes shape based on the OHLC prices. I will give this a shot.

Mar 11, 2009 at 11:03 PM
To acheive the OHLC garph marker, there are a number of steps beyond what I've posted
1) Create a DataTemplate to display the data how you want
2) Create an underlying data class for the OHLC data, and bind that to the template
3) Integrate that Template inot DDD
4) Within DDD set the DataContext of each marker appropriately
I'd be interested in input from the DDD team as to whether this feature is going into the build?
Mar 27, 2009 at 9:33 AM
Hi, MrTelly!

You've described method of creating markers, we are going to develop, and you'll probably get it in next release of DynamicDataDisplay.

Mar 27, 2009 at 10:45 PM

On Fri, Mar 27, 2009 at 4:33 AM, Thecentury <> wrote:

From: Thecentury

Hi, MrTelly!

You've described method of creating markers, we are going to develop, and you'll probably get it in next release of DynamicDataDisplay.


Read the full discussion online.

To add a post to this discussion, reply to this email (

To start a new discussion for this project, email

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at

There are only 10 types of people in this world. Those who can read binary and those who can't.
Jul 7, 2009 at 3:02 AM
Edited Jul 7, 2009 at 3:03 AM

When will the next version of DDD come out? Will it have candlestick diagrams built in or will we need to extend DDD ourselves?