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

Binding MapEllipse Location

5 Answers 210 Views
Map
This is a migrated thread and some comments may be shown as answers.
Savva
Top achievements
Rank 1
Savva asked on 14 Jan 2019, 09:03 AM

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

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 16 Jan 2019, 02:06 PM
Hello Savva,

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
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Savva
Top achievements
Rank 1
answered on 17 Jan 2019, 04:29 PM

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!

 

0
Vladimir Stoyanov
Telerik team
answered on 21 Jan 2019, 03:54 PM
Hello Savva,

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
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Savva
Top achievements
Rank 1
answered on 22 Jan 2019, 05:45 PM

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!

0
Vladimir Stoyanov
Telerik team
answered on 25 Jan 2019, 01:27 PM
Hello Savva,

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
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Map
Asked by
Savva
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Savva
Top achievements
Rank 1
Share this question
or