//Must be on QueuedTask.Run(() => { ...
//Build geometry
List<Coordinate2D> plyCoords = new List<Coordinate2D>();
plyCoords.Add(new Coordinate2D(1, 1));
plyCoords.Add(new Coordinate2D(1.25, 2));
plyCoords.Add(new Coordinate2D(1.5, 1.1));
plyCoords.Add(new Coordinate2D(1.75, 2));
plyCoords.Add(new Coordinate2D(2, 1.1));
plyCoords.Add(new Coordinate2D(2.25, 2));
plyCoords.Add(new Coordinate2D(2.5, 1.1));
plyCoords.Add(new Coordinate2D(2.75, 2));
plyCoords.Add(new Coordinate2D(3, 1));
Polygon poly = PolygonBuilderEx.CreatePolygon(plyCoords);
//Set symbology, create and add element to layout
CIMStroke outline = SymbolFactory.Instance.ConstructStroke(
ColorFactory.Instance.BlackRGB, 2.0, SimpleLineStyle.Solid);
CIMPolygonSymbol polySym = SymbolFactory.Instance.ConstructPolygonSymbol(
ColorFactory.Instance.RedRGB, SimpleFillStyle.ForwardDiagonal, outline);
var graphic = GraphicFactory.Instance.CreateLegendPatchGraphic(
PatchShape.AreaBoundary, poly.Extent, polySym);
//Make an element to add to GraphicsLayer or Layout
//
//var elemInfo = new ElementInfo()
//{
// CustomProperties = null,
// Anchor = Anchor.LeftMidPoint
//};
//var ge = ElementFactory.Instance.CreateGraphicElement(container, graphic,
// "New Legend Patch", true, elemInfo);