Hi!
In my application I show some coordinates on the map as annotations to the main ShapeLayer. The map shows them correctly, but at runtime, the list of annotations may change depending on user input. But whilst the list of annotation changes, the circles shown on the map do not. How can I make the map update when its viewmodel changes?
This is my annotation type:
public class ConnectionAnnotation : Annotation
{
public ConnectionViewModel Connection { get; set; }
public Countries Country { get; set; }
public ConnectionAnnotation(ConnectionViewModel connection,
DbGeography location, Countries country)
{
Connection = connection;
Longitude = location.Longitude ?? 0;
Latitude = location.Latitude ?? 0;
Country = country;
}
}
The map is bound to an ObservableCollection<Annotation> yet it does not change when the annotation list changes.
shapeLayer.Annotations = viewModel.AnnotationList;
newMapsControl1.AnnotationDrawing += mapsControl_AnnotationDrawing;
newMapsControl1.Layers.Add(shapeLayer);
So can you please help me update / refresh the map?
I tried
this.mapsControl.UpdateLayers();
but it did not work!
Best wishes!