/// <summary>
/// Create a polygon symbol using the ConstructGradientFill method. Constructs a gradient fill using the specified color ramp. <br/>
/// 
/// </summary>
{
//Note: Run withing QueuedTask
//outine
CIMStroke outline = SymbolFactory.Instance.ConstructStroke(CIMColor.CreateRGBColor(49, 49, 49), 2.0, SimpleLineStyle.Solid);
//gradient fill using a color ramp
var gradientFill = SymbolFactory.Instance.ConstructGradientFill(GetColorRamp(), GradientFillMethod.Linear);
List<CIMSymbolLayer> symbolLayers = new List<CIMSymbolLayer>
{
outline,
gradientFill
};
CIMPolygonSymbol gradientColorRampSymbol = new CIMPolygonSymbol() { SymbolLayers = symbolLayers.ToArray() };
//To apply the symbol to a polygon feature layer
//var renderer = theLayer.GetRenderer() as CIMSimpleRenderer;
//renderer.Symbol = gradientColorRampSymbol.MakeSymbolReference();
//theLayer.SetRenderer(renderer);
//Helper method to get a color ramp from the "ArcGIS Colors" style.
static CIMColorRamp GetColorRamp()
{
//Get a ColorRamp
StyleProjectItem style =
Project.Current.GetItems<StyleProjectItem>().FirstOrDefault(s => s.Name == "ArcGIS Colors");
var colorRampList = style.SearchColorRamps("Heat Map 4 - Semitransparent");
CIMColorRamp colorRamp = colorRampList[0].ColorRamp;
return colorRamp;
}
}