Binding MapEllipse Location

6 posts, 0 answers
  1. Savva
    Savva avatar
    5 posts
    Member since:
    Nov 2018

    Posted 14 Jan Link to this post

    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

  2. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    398 posts

    Posted 16 Jan Link to this post

    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.
  3. Savva
    Savva avatar
    5 posts
    Member since:
    Nov 2018

    Posted 17 Jan in reply to Vladimir Stoyanov Link to this post

    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!

     

  4. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    398 posts

    Posted 21 Jan Link to this post

    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.
  5. Savva
    Savva avatar
    5 posts
    Member since:
    Nov 2018

    Posted 22 Jan in reply to Vladimir Stoyanov Link to this post

    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!

  6. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    398 posts

    Posted 25 Jan Link to this post

    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.
Back to Top