After importing shape file to xamMap, I tried to add some bubble SymbolElements.
But bubbles are behind SurfaceElements. How could i bring bubble to front ?
I tried setting value to ZIndex of SymbolElement. But it doesn't work.
Thanks for your help.
Regards,
Nyi Nyi
Hi Nyi Nyi,
If you use one layer to both contain your shapefile and add SymbolElements to, you only have to make sure that you add the SymbolElements after MapLayerImportAction.End as explained here:http://help.infragistics.com/NetAdvantage/DV/2010.3/CLR4.0/?page=xamWebMap_Add_Symbol_Element.html
In case you use two layers, one for the shapefile and another for the SymbolElements, a sample approach is the following:XAML: <Grid x:Name="LayoutRoot" Background="White"> <igMap:XamMap x:Name="map1"> <igMap:XamMap.Layers> <igMap:MapLayer x:Name="statesLayer" Imported="statesLayer_Imported"> <igMap:MapLayer.Reader> <igMap:ShapeFileReader Uri="Shapefiles/usa/usa_st"/> </igMap:MapLayer.Reader> </igMap:MapLayer> <igMap:MapLayer x:Name="symbolLayer"/> </igMap:XamMap.Layers> </igMap:XamMap> </Grid>Code Behind: private void statesLayer_Imported(object sender, Infragistics.Controls.Maps.MapLayerImportEventArgs e) { if (e.Action == MapLayerImportAction.End) { Point origin = map1.MapProjection.ProjectToMap(new Point(-101.6015625, 42.032974332441405)); SymbolElement element = new SymbolElement() { SymbolOrigin = origin, Caption = "Marker", SymbolType = MapSymbolType.Bubble, SymbolSize = 10 };
map1.Layers[1].Elements.Add(element);
Rect worldRect = map1.Layers[1].WorldRect; worldRect.Union(element.WorldRect);
map1.Layers[1].WorldRect = worldRect; } }
Best regards,
Milana Zhileva
HI Milana,
Thanks for the reply.
I guess i should have mentioned about the detail scenario in previous question. First, I created 2 layers. The first layer is filled with world map data. Upon clicking on map elements which are representing country shape, that clicked element is filled with a solid color. And then a small bubble symbol element representing the capital city is added to another layer. I noticed that the bubble is always behind the country element.
I'd like bring the bubble to front. Please point me out.
Thanks.
You could try something like this:
XAML: <igMap:XamMap x:Name="map1"> <igMap:XamMap.Layers> <igMap:MapLayer x:Name="worldLayer"> <igMap:MapLayer.Reader> <igMap:ShapeFileReader Uri="Shapefiles/world/world" DataMapping="Name,Caption=CNTRY_NAME"/> </igMap:MapLayer.Reader> </igMap:MapLayer> <igMap:MapLayer x:Name="symbolLayer"/> </igMap:XamMap.Layers> </igMap:XamMap>
CB: public MainPage() { InitializeComponent();
map1.ElementClick += map1_ElementClick; }
void map1_ElementClick(object sender, MapElementClickEventArgs e) { e.Element.Fill = new SolidColorBrush(Colors.Orange);
Point origin = e.Element.ActualSymbolOrigin;
SymbolElement element = new SymbolElement() { SymbolOrigin = origin, Caption = "Marker", SymbolType = MapSymbolType.Bubble, SymbolSize = 10 };
map1.Layers[1].WorldRect = worldRect; }
Hope that helps,