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,
M