If I want a data driven map that updates live data, I would need to add and remove line elements all the time. I can certainly add lines but I see no way to search the elements list so I can remove them.
So my specific questions:
-- What is the best practice for tagging elements so they can be found for subsequent removal?
-- Is removal as simple as deleting an element from the Elements list? Am I that lucky?
thanks
Roger
try this:
private void MapLayer_Imported(object sender, MapLayerImportEventArgs e) { if (e.Action == MapLayerImportAction.End) { MapLayer layer = sender as MapLayer; MapElement france = layer.Elements.FindElement("Name", "France").FirstOrDefault(); layer.Elements.Remove(france); } }
<igMap:XamWebMap x:Name="xamWebMap1"> <igMap:XamWebMap.Layers> <igMap:MapLayer Imported="MapLayer_Imported"> <igMap:MapLayer.Reader> <igMap:ShapeFileReader Uri="world" DataMapping="Name=CNTRY_NAME" /> </igMap:MapLayer.Reader> </igMap:MapLayer> </igMap:XamWebMap.Layers> </igMap:XamWebMap>
Another short follow up. I just found the stuff about adding custom propertyies. Very nice and more than adequate for my purposes.
Now if I can just remove an element....
Just a short follow up. I found the name field which I can hijack for my purposes of identifying and tying multiple elements together for subsequent removal.
I tried removing an element by simply removing it from the element list but the screen went blank. hmmm... I will play around more today.