Solved! Go to Solution.
I tried using TextSymbols for the placemarks
but I'm having a zIndex issue with the TextSymbols showing below the other graphics.
You can see from the remarked out code that I tried to fix the zIndex and use a KmlPlaceMarkerSymbol, but no luck.
private void KmlLayer_Initialized(object sender, EventArgs e) { KmlLayer kmlLayer = sender as KmlLayer; var placemarkers = kmlLayer.Graphics.Where(g => g.Symbol is KmlPlaceMarkerSymbol).ToList(); placemarkers.ForEach(p => p.Symbol = new TextSymbol() { Text = p.Attributes["name"].ToString(), FontSize = 20, OffsetX = 5 * p.Attributes["name"].ToString().Count(), OffsetY = 8 }); var regions = kmlLayer.ChildLayers["FEMA Regions"] as KmlLayer; if (regions != null) { // move placemarks layer at the end var placemarks = regions.ChildLayers["Placemarks"]; if (placemarks != null) { regions.ChildLayers.Remove(placemarks); regions.ChildLayers.Add(placemarks); // add it at the end } } }
private void KmlLayer_Initialized(object sender, EventArgs e) { var regionXSymbols = ((KmlLayer)MyMap.Layers[1]).Graphics.Where(g => g.Attributes.Any(ga => ga.Value.ToString() == "Region X")).Select(g => g.Symbol as SimpleFillSymbol); regionXSymbols.ToList().ForEach(s => s.Fill = new SolidColorBrush(Colors.Red)); var placemarkers = ((KmlLayer)MyMap.Layers[1]).Graphics.Where(g => g.Symbol is KmlPlaceMarkerSymbol).ToList(); placemarkers.ForEach(p => p.Symbol = new TextSymbol() { Text = p.Attributes["name"].ToString(), FontSize=20}); //placemarkers.ForEach(g => { g.Symbol = (KmlPlaceMarkerSymbol)Resources["KmlPlaceMarkerSymbol"]; g.SetZIndex(1000000); }); }
The whats new section in the 2.3 documentation says it supports placemarks
"The KmlLayer was rebuilt as a GroupLayer (also new in 2.3) to better represent KML content. It includes support for nested folders (layers), setting visibility of layers, placemarks, ground overlays, regions, network links, auto-refresh on network links, and more. Support for display in the Legend control has also been added."
I tried using TextSymbols for the placemarks
but I'm having a zIndex issue with the TextSymbols showing below the other graphics.
You can see from the remarked out code that I tried to fix the zIndex and use a KmlPlaceMarkerSymbol, but no luck.
private void KmlLayer_Initialized(object sender, EventArgs e) { KmlLayer kmlLayer = sender as KmlLayer; var placemarkers = kmlLayer.Graphics.Where(g => g.Symbol is KmlPlaceMarkerSymbol).ToList(); placemarkers.ForEach(p => p.Symbol = new TextSymbol() { Text = p.Attributes["name"].ToString(), FontSize = 20, OffsetX = 5 * p.Attributes["name"].ToString().Count(), OffsetY = 8 }); var regions = kmlLayer.ChildLayers["FEMA Regions"] as KmlLayer; if (regions != null) { // move placemarks layer at the end var placemarks = regions.ChildLayers["Placemarks"]; if (placemarks != null) { regions.ChildLayers.Remove(placemarks); regions.ChildLayers.Add(placemarks); // add it at the end } } }