public RendererDefinition RendererDefinition {get; set;}
Public Property RendererDefinition As RendererDefinition
public RendererDefinition RendererDefinition {get; set;}
Public Property RendererDefinition As RendererDefinition
var flyrCreatnParam = new FeatureLayerCreationParams(new Uri(@"c:\data\world.gdb\cities")) { Name = "World Cities", IsVisible = false, MinimumScale = 1000000, MaximumScale = 5000, // At 2.x - DefinitionFilter = new CIMDefinitionFilter() //{ // DefinitionExpression = "Population > 100000", // Name = "More than 100k" //}, DefinitionQuery = new DefinitionQuery(whereClause: "Population > 100000", name: "More than 100k"), RendererDefinition = new SimpleRendererDefinition() { SymbolTemplate = SymbolFactory.Instance.ConstructPointSymbol( CIMColor.CreateRGBColor(255, 0, 0), 8, SimpleMarkerStyle.Hexagon).MakeSymbolReference() } }; var featureLayer = LayerFactory.Instance.CreateLayer<FeatureLayer>( flyrCreatnParam, map);
//Note: Call within QueuedTask.Run() if (MapView.Active.Map == null) return; //Get an existing Layer. This layer has a symbol you want to use in a new layer. var lyr = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>() .Where(l => l.ShapeType == esriGeometryType.esriGeometryPoint).FirstOrDefault(); //This is the renderer to use in the new Layer var renderer = lyr.GetRenderer() as CIMSimpleRenderer; //Set the Dataconnection for the new layer Geodatabase geodatabase = new Geodatabase( new FileGeodatabaseConnectionPath(new Uri(@"E:\Data\Admin\AdminData.gdb"))); FeatureClass featureClass = geodatabase.OpenDataset<FeatureClass>("Cities"); var dataConnection = featureClass.GetDataConnection(); //Create the definition for the new feature layer var featureLayerParams = new FeatureLayerCreationParams(dataConnection) { RendererDefinition = new SimpleRendererDefinition(renderer.Symbol), IsVisible = true, }; //create the new layer LayerFactory.Instance.CreateLayer<FeatureLayer>( featureLayerParams, MapView.Active.Map);
var url = @"https://geoeventsample1.esri.com:6443/arcgis/rest/services/LABus/StreamServer"; var uri = new Uri(url, UriKind.Absolute); //Must be on QueuedTask! var createParams = new FeatureLayerCreationParams(uri) { RendererDefinition = new SimpleRendererDefinition() { SymbolTemplate = SymbolFactory.Instance.ConstructPointSymbol( ColorFactory.Instance.BlueRGB, 12, SimpleMarkerStyle.Pushpin).MakeSymbolReference() } }; var streamLayer = LayerFactory.Instance.CreateLayer<StreamLayer>( createParams, map);
Target Platforms: Windows 11, Windows 10