This is a migrated thread and some comments may be shown as answers.

Creating MapPinPoints In Code

1 Answer 127 Views
Map
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ian
Top achievements
Rank 1
Ian asked on 14 Feb 2012, 05:55 AM
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);


1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 16 Feb 2012, 03:19 PM
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 >>
Tags
Map
Asked by
Ian
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or