Last Updated: 20 Oct 2023 14:01 by ADMIN
Martin Ivanov
Created on: 16 Oct 2023 10:33
Category: Map
Type: Bug Report
Map: Position of the visual defined in ItemTemplate of VisualizationLayer is not updated on location changed if the visual is outside the viewport

When the VisualizationLayer is populated with FrameworkElement objects (often through the ItemTemplate) and the MapLayer.Location value of a FrameworkElement is updated at runtime, the element itself is not moved to the new location. This happens only if the FrameworkElement is outside of the viewport during the location change action.

To work this around, on location change, remove the data element from the ItemsSource and add it again.

1 comment
Vladimir Stoyanov
Posted on: 20 Oct 2023 14:00

This scenario is supported through the INotifyLocationChanged interface. The business item should implement this interface and raise the LocationChanged event when the property that controls the location is changed. The old and the new location should be provided in the event arguments. Here is an example implementation:

public class PinInfo : ViewModelBase, INotifyLocationChanged
    private Location location;

    public event EventHandler<LocationChangedEventArgs> LocationChanged;

    public Location Location
        get { return location; }
            var oldLocation = this.location;
            this.location = value; 
            this.OnLocationChanged(oldLocation, this.location);

    public void OnLocationChanged(Location oldLocation, Location newLocation)
        if (LocationChanged != null)
            LocationChanged(this, new LocationChangedEventArgs(oldLocation, newLocation));

Vladimir Stoyanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.