var lyrDocFromLyrxFile = new LayerDocument(@"d:\data\cities.lyrx"); var cimLyrDoc = lyrDocFromLyrxFile.GetCIMLayerDocument(); //modifying its renderer symbol to red var r = ((CIMFeatureLayer)cimLyrDoc.LayerDefinitions[0]).Renderer as CIMSimpleRenderer; r.Symbol.Symbol.SetColor(new CIMRGBColor() { R = 255 }); //optionally save the updates out as a file lyrDocFromLyrxFile.Save(@"c:\data\cities_red.lyrx"); //get a json representation of the layer document and you want store away... var aJSONString = lyrDocFromLyrxFile.AsJson(); //... and load it back when needed lyrDocFromLyrxFile.Load(aJSONString); cimLyrDoc = lyrDocFromLyrxFile.GetCIMLayerDocument(); //create a layer and add it to a map var lcp = new LayerCreationParams(cimLyrDoc); var lyr = LayerFactory.Instance.CreateLayer<FeatureLayer>(lcp, map, LayerPosition.AutoArrange);
System.Object
ArcGIS.Desktop.Mapping.Document
ArcGIS.Desktop.Mapping.LayerDocument
Target Platforms: Windows 10, Windows 8.1