We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Update map annotations

Thread ID:

Created:

Updated:

Platform:

Replies:

131129 Jun 22,2017 09:38 AM Jun 23,2017 02:55 AM Windows Forms 1
loading
Tags: Maps
MS
Asked On June 22, 2017 09:38 AM

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!

Ashwin Kumaravel [Syncfusion]
Replied On June 23, 2017 02:55 AM

Hi MS,

Thank you for using Syncfusion products,

We have validated your query, could you please call Refresh method along with UpdateLayers to refresh the map elements?

Please refer the following code snippet for your references,

     mapsControl1.UpdateLayers();
     mapsControl1.Refresh();


Please get back us if you have any concern.

Regards,
Ashwin.k


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;