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.
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; }
set
{
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));
}
}
}
Regards,
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.