I am using XamMap with Chloropleth Fill Mode to display data, such as state population or average rainfall (of different years), which are provided by SQL server through WCF/RIA. I got a problem that the map didn’t refresh color when the source data updated. How to force the map elements to refresh colors when source data update? By the way, after I bound the same RIA source data to XamGrid and XamMap, the XamGrid refreshed and XamMap didn’t refresh when the RIA source data updated.
Thanks.
Hi _user,
It seems that the issue appears because both operation are executed asynchronously. Try the following: attach to MapLayer's Imported event and after MapLayerImportAction.End is received call the service for map color data. When you receive the data iterate over MapLayer's Elements and set theirs values.
Regards,
Ivan Kotev
Hi, Ivan,
Thanks for the sample code.
I think I get the key of the issue that I can not assure that the map display data after the data are loaded completely from SQL server via RIA NOT before data are loaded completely, though I attach MapLayer's Imported event that seems only work with Map shape data.
You can follow the below steps to reproduce the issue:
1. Get map shape data from Shapefile;
2. Get map color data from SQL server via RIA,
3. Use WAITFOR DELAY at SQL Server side to deliberately delay data return for 5 seconds or longer.
4. Change data dynamically;
Please take a look at this sample project It uses SqlShapeReader and changes data dynamically.
Could you make the necessary changes to reproduce the issue so we can investigate it furtfer ?
You can attach to MapLayer's Imported event. After data is imported the event is raised and MapLayerImportEventArgs.Action property is set to MapLayerImportAction.End (i.e. Layer import has finished without error).
All you mentioned was set. By the way, how to assure that the map display data after the data are loaded completely from SQL server via RIA NOT before data are loaded completely? Thanks.