VisualizationLayer not displaying correctly items

3 posts, 0 answers
  1. Romain
    Romain avatar
    2 posts
    Member since:
    Sep 2016

    Posted 25 Apr 2017 Link to this post



    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. Romain
    Romain avatar
    2 posts
    Member since:
    Sep 2016

    Posted 25 Apr 2017 Link to this post

    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


  3. Martin Ivanov
    Martin Ivanov avatar
    1546 posts

    Posted 28 Apr 2017 Link to this post

    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.
            <Ellipse Width="10" Height="10" Fill="Red" telerik:MapLayer.Location="{Binding MyLocationProperty}" />

    I hope this helps.

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