Creating MapPinPoints In Code

2 posts, 0 answers
  1. Ian
    Ian avatar
    23 posts
    Member since:
    Jun 2011

    Posted 13 Feb 2012 Link to this post

    I have recently switched from using an information layer to a dynamic layer, previously i was using templates to dictate the style of the pinpoint on display and i am trying to recreate that in code for the dynamic layer

    What the code below does is show a mappinpoint with a different image depending on its sitetype binding. But what i also want todo is also display some text above the pinpoint indicating the name of the location (l.Name)

    Using mapp.Text = l.Name has no effect. Any idea how i can create a text property which displays above the pinpoint.

    Also any idea how todo draw balloons e.t.c as shown on this demo but in the code behind and not the xaml ?

    Its basically what i want. Pinpoint at certain zoom levels and then pinpoint + baloon or text and different zoom levels.


    See code below.


    MapPinPoint mapp = new MapPinPoint();

    mapp.Width = 50;

    mapp.Height = 50;



    MapLayer.LocationProperty, l.Location);

    mapp.Text = l.Name;


    MapLayer.SetHotSpot(mapp, centerSpot);


    ToolTipService.SetToolTip(mapp, l.Name);




    Binding binding = new Binding("SiteType");

    binding.Source = l;

    binding.Converter =


    new NodeSiteTypeImageConverter();



    MapPinPoint.ImageSourceProperty, binding);

  2. Andrey
    Andrey avatar
    1681 posts

    Posted 16 Feb 2012 Link to this post

    Hello Ian,

    If you want to use different templates for different zoom levels, then I would recommend that you use a template selector which returns different templates for different zoom levels. I have attached a sample solution which uses one template for levels 1-7 and another for 8 and higher. Note, the solution uses the information layer with InformationLayer.AllowDataTemplateForZoomLevel. It allows the information layer to change template for different zoom levels. Usually this property is not required for the dynamic layer. This is because the items are re-requested for different zoom levels.

    I hope this helps.

    Andrey Murzov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top