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.
Syncfusion Feedback

Updating the Shape Layer Item Source and refreshing Map

Thread ID:

Created:

Updated:

Platform:

Replies:

130715 May 29,2017 02:03 AM UTC Jun 15,2017 10:22 AM UTC Windows Forms 3
loading
Tags: Maps
MS
Asked On May 29, 2017 02:03 AM UTC

Hello!
I am building a WinForms app which makes use of the Maps control. My data source is a list of countries defined as:
public class CountryViewModel : INotifyPropertyChanged
    {
        private int selected;
        public int Selected
        {
            get
            { return selected; }
            set
            { selected = value; NotifyPropertyChanged("Selected"); }
        }

        # region Implementing INotifyPropertyChanged
        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged(String info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }

I have used the one ShapeLayer to load the map of the world  and furthermore I have added a ColorMapping such that Countries with Selected = 1 show in a different colour.

My map also allows selection. What I wish to do is to colour the countries I have selected with a ColorMapping.
What I have done is that when catching the ShapeSelected event of the map I update the ViewModel such that the selected country will have the Selected value toggled to one. Then to my understanding all I need to do is refresh the data source, and the ColorMapping should color these newly selected countries as I wish.
I have tried to refresh the map, to update the data source, to add another ShapeLayer with this updated data source, and nothing worked. 
How can I now refresh the data source of the map at runtime such that I can colour or uncolour the countries I have selected or deselected?

Thank you kindly for all your help,

Ashwin Kumaravel [Syncfusion]
Replied On May 30, 2017 07:18 AM UTC

Hi MS,

Thanks for using Syncfusion products,

We have validated your query and created a sample based on your requirement in which we have coloured the selected shape using colourMapping. Whenever new shape is selected its get updated in the ViewModel and the selected shape is rendered with different colors using EqualColorMapping.

Please find the sample from the below link, 
Sample-MapsSample

Screenshot- 

Please get back to us if you have any concern

Regards,
Ashwin.k
 


MS
Replied On June 14, 2017 04:04 PM UTC

Thank you, this was very helpful!

Ashwin Kumaravel [Syncfusion]
Replied On June 15, 2017 10:22 AM UTC

Hi MS,

We are glad to know that you have met your requirement. Please let us know if you have any queries.

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.

Warning Icon 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.Close Icon

;