AnsweredAssumed Answered

GraphicsOverlay - adding points of different color

Question asked by jon.shuler on May 31, 2019
Latest reply on Jun 3, 2019 by KMcCarty-esristaff

We are doing some testing of the SDK Runtime using C# & WPF.  I started with the "Display point, line, and polygon graphics" tutorial and added the following code:

 

private void DisplayPoints(SqlGeography geometry, Color pointColor, bool displayOnMap = true)
{
var numGeometries = geometry.STNumGeometries();
for (int i = 0; i < geometry.STNumGeometries(); i++)
{
var polygonPoints = new Esri.ArcGISRuntime.Geometry.PointCollection(SpatialReferences.Wgs84);
var numSTPoints = geometry.STGeometryN(i + 1).STNumPoints();
for (int j = 1; j <= numSTPoints; j++)
{
var point = geometry.STPointN(j);
pointSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, pointColor, 5);
pointSymbol.Outline = new SimpleLineSymbol(SimpleLineSymbolStyle.Null, pointColor, 1);

var pointGraphic = new Graphic(new MapPoint((double)point.Long, (double)point.Lat, SpatialReferences.Wgs84), pointSymbol);

MapGraphics.Graphics.Add(pointGraphic);
}
}
}
}

 

I am loading some geography data from a db and displaying on the map.  Everything works except the points are always the same color no matter what color is passed in.  I determined that whatever is the last color of the last point added wins.

 

If I want to add a bunch of points (or polygons) what is the proper way to set the colors if I need them to be different.

Outcomes