Hello!
In our app we are using dynamicly generated shapes on theRadMap via map shapes.
All shapes areimplimented as Datatemplates on map Information layers. And it all works ok, until we come to MapEllipse.
An attempt tp bind MapEllipse location to the Location property of the model, Exception is thrown, beacuse Locatuion is mot a Dependency Property.
Is there any way to solve the prolem, excep implemening new calss, based on MapEllipse with custom DependencyProperty?
Thank you
5 Answers, 1 is accepted
Can you check out the InformationLayerDataBindingInDataTemplate RadMap SDK example which shows how you can bind the MapLayer.Location attached property to a property in your model? Please, give this approach a try and let me know if you find it helpful.
Regards,
Vladimir Stoyanov
Progress Telerik

Hello, Vladimir!
Thank you for reply!
It seems, that variant doesn'tseems to work. My initial code .
</
telerik:InformationLayer
>
<
telerik:InformationLayer
Name
=
"CircleZonesLayer"
>
<
telerik:InformationLayer.ItemTemplate
>
<
DataTemplate
>
<
telerik:MapEllipse
Name
=
"MapCicrlceZone"
Width
=
"{Binding Width}"
Height
=
"{Binding Height}"
Location
=
"{Binding Path=Location}"
Fill
=
"#7FFFFF00"
Stroke
=
"Red"
StrokeThickness
=
"2"
>
<
telerik:MapLayer.HotSpot
>
<
telerik:HotSpot
X
=
"0.5"
Y
=
"0.5"
/>
</
telerik:MapLayer.HotSpot
>
</
telerik:MapEllipse
>
</
DataTemplate
>
</
telerik:InformationLayer.ItemTemplate
>
</
telerik:InformationLayer
>
It works wellwith size changing, but any attempts to bind location only finish with Exception. But if I hardcode Location coordinates, it works perfectly.
I tried to use same pattern, as you suggested
<
telerik:InformationLayer
Name
=
"CircleZonesLayer"
>
<
telerik:InformationLayer.ItemTemplate
>
<
DataTemplate
>
<
Grid
telerik:MapLayer.BaseZoomLevel
=
"{Binding BaseZoomLevel}"
telerik:MapLayer.Location
=
"{Binding Location}"
telerik:MapLayer.ZoomRange
=
"{Binding ZoomRange}"
>
<
telerik:MapLayer.HotSpot
>
<
telerik:HotSpot
X
=
"0.5"
Y
=
"0.5"
ElementName
=
"PART_Ellipse"
/>
</
telerik:MapLayer.HotSpot
>
<
telerik:MapEllipse
x:Name
=
"PART_Ellipse"
Width
=
"{Binding Width}"
Height
=
"{Binding Height}"
Fill
=
"#7FFFFF00"
Stroke
=
"Red"
StrokeThickness
=
"2"
>
</
telerik:MapEllipse
>
</
Grid
>
</
DataTemplate
>
</
telerik:InformationLayer.ItemTemplate
>
</
telerik:InformationLayer
>
But in that way the circle just does not appear ath the Map.
The point is using MapEllipse, because it is not affected by Zoom and covers same territory not deppending on the Zoom level.
Maybe I don't get some point of Ellipse and Map Ellipse?
Thank ypu once more!
Thank you for the update.
Please, note that placing Map Shapes such as MapEllipse inside DataTemplates is not fully supported. In your scenario, you can use an Ellipse as in the referenced SDK example from my previous reply.
On a side note, we generally encourage switching to VisualizationLayer (VL) since it has some improvements over the InformationLayer.
Hope this helps.
Regards,
Vladimir Stoyanov
Progress Telerik

Thank you for reply!
You mentioned Visualization Layer. So, if I understand ypu correctly,if I use VL and EllipseData, insteared of IL and MapEllipse, Location binding and Dynamic generation of the ellipse willwork correctly?
And anothwer question: can VL Item be clickable on tha map?
Thank you once again!
The Map Shape Data objects implemented for the VisualizationLayer such as EllipseData cannot be put in a DataTemplate since they are not dependency objects. This, however allows them to be created in a background thread.
As for clicking an item when using the VisualizationLayer, you can check out the VisualizationLayerItemsSelection SDK example.
Regards,
Vladimir Stoyanov
Progress Telerik