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 http://demos.telerik.com/silverlight/#Map/DataBinding 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.

    Thanks

    See code below.

     

    MapPinPoint mapp = new MapPinPoint();

    mapp.Width = 50;

    mapp.Height = 50;

    mapp.SetValue(

     

    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();

    mapp.SetBinding(

     

    MapPinPoint.ImageSourceProperty, binding);


  2. Andrey
    Admin
    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.

    Greetings,
    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 >>
  3. DevCraft banner
Back to Top