AnsweredAssumed Answered

How to set color property of symbols using Xamarin UWP project

Question asked by LawsonTyler on Mar 15, 2018
Latest reply on Mar 15, 2018 by mnielsen-esristaff

Hello,

 

Currently, I am trying to get some symbols to display on a map using a xamarin uwp project, but I am having a problem reconciling the color properties of various symbols in UWP. It seems like the color properties (i.e TextColor, BackgroundColor, etc) are based on System.Drawing.Color, which is incompatible with UWP. Is there some way to set the color properties of the symbols in Esri.ArcGISRuntime.Symbology or are there any other options that would be more compatible with UWP that accomplish the same thing? I have tried using Xamarin.Color but so far it has not worked.

 

Example (Drawing a rectangle to put on map):

//Set draw mode and create geometry

Esri.ArcGISRuntime.UI.SketchCreationMode drawMode = Esri.ArcGISRuntime.UI.SketchCreationMode.Rectangle;
Esri.ArcGISRuntime.Geometry.Geometry geometry = await this.map.SketchEditor.StartAsync(drawMode, false);

 

//Create fill symbol

var fillSymbol = new Esri.ArcGISRuntime.Symbology.SimpleFillSymbol(SimpleFillSymbolStyle.Solid, color, new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, color, 2));

//color throws an error because it is not of the correct type

 

//Create graphic based on drawn geometry and fill symbol and add to map

var graphic = new Esri.ArcGISRuntime.UI.Graphic(geometry, fillSymbol);

this.map.GraphicsOverlays["MapShapes"].Graphics.Add(graphic);

 

 

Affected symbols and properties:

  • TextSymbol: BackgroundColor, Color, HaloColor, OutlineColor
  • SimpleFillSymbol: Color
  • SimpleLineSymbol: Color

 

 

NOTE: Symbols can be added to the map and manipulated by using the default symbol (default constructor with no arguments), however I have not been able to manipulate any symbol's color properties.

 

Any help on this issue would be appreciated.

Outcomes