Could someone please provide an example to add a label to the map. I’ve found some examples that are very verbose with a number of unnecessary string literal inter-dependencies. Surely it must be possible to add a label with a style to a feature and then to a overlay. This example works but surely it can be simplified.
private void AddLabel()
{
labelOverlay = new EditInteractiveOverlay();
labelOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.IsActive = false;
labelOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle.IsActive = false;
labelOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.IsActive = false;
labelOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.IsActive = false;
TextStyle unitTextStyle = new TextStyle("UnitLabel", new GeoFont("Arial", 18), new GeoSolidBrush(GeoColor.SimpleColors.Red));
ValueStyle labelValueStyle = new ValueStyle();
labelValueStyle.ColumnName = "UnitLabel";
labelValueStyle.ValueItems.Add(new ValueItem("WTF", unitTextStyle));
labelOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(labelValueStyle);
labelOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
labelOverlay.EditShapesLayer.Open();
labelOverlay.EditShapesLayer.Columns.Add(new FeatureSourceColumn("UnitLabel"));
labelOverlay.EditShapesLayer.Close();
PointShape pointShape = new PointShape(424047, 568503);
Feature feature = new Feature(pointShape);
feature.ColumnValues["UnitLabel"] = "WTF";
labelOverlay.EditShapesLayer.InternalFeatures.Add("testFeature", feature);
wpfMap.InteractiveOverlays.Add("Labels", labelOverlay);
wpfMap.Refresh();
}