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

VisualizationLayer not displaying correctly items

2 Answers 97 Views
Map
This is a migrated thread and some comments may be shown as answers.
Benoit
Top achievements
Rank 1
Benoit asked on 25 Apr 2017, 01:20 PM

Hello,

 

I have an issue about your VisualizationLayer.

I bind the layer's ItemsSource on an ObservableCollection<Element> and each Element has a Location bind on MapLayer.Location (as in your samples)

But when I clear my collection et reload all data (without manipulating the map) all my points disappear

I tried a few things like use another property with a converter for the location but it's worse then if my map is centered on the correct location all my points are in lat :0, lng : 0 and if the map isn't centered on the location (the view doesn't show the location) my points are correctly loaded when I move the map on the correct location

 

I only use your sample and adjust the collection loading or reloading

 

Do you see what i'm doing wrong please ?

 

Thank You

2 Answers, 1 is accepted

Sort by
0
Benoit
Top achievements
Rank 1
answered on 25 Apr 2017, 05:33 PM

Hello again,

 

I tried some other stuff and I found that the visualizationlayer find automatically the MapLayer.Location if my ViewModel has a property of type Location (my DataTemplate doesn't specify MapLayer.Location)

Now the display works correctly with that property but I can't PropertyChanged it because there is no actual binding on it, it doesn't re-get the property to update the location

 

Do you have any ideas ?

 

Thank you

 

0
Martin Ivanov
Telerik team
answered on 28 Apr 2017, 12:09 PM
Hello Romain,

I am not sure which example you are using and how you reload the data, but I prepared a small example based on the provided information. Everything seems working. Can you please give it a try and let me know if I am missing something?

About the automatic Location binding, you can disable this via the UseDefaultPropertyAccessor property.
<telerik:VisualizationLayer UseDefaultPropertyAccessor="False"/>
Then you can manually bind your location property in from view model.
<telerik:VisualizationLayer.ItemTemplate>
    <DataTemplate>
        <Ellipse Width="10" Height="10" Fill="Red" telerik:MapLayer.Location="{Binding MyLocationProperty}" />
    </DataTemplate>
</telerik:VisualizationLayer.ItemTemplate>

I hope this helps.

Regards,
Martin
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
Map
Asked by
Benoit
Top achievements
Rank 1
Answers by
Benoit
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or