public LayerCreationRollbackBehavior RollbackBehavior {get; set;}
Public Property RollbackBehavior As LayerCreationRollbackBehavior
public LayerCreationRollbackBehavior RollbackBehavior {get; set;}
Public Property RollbackBehavior As LayerCreationRollbackBehavior
When a set of LayerCreationParams objects exist, the bulk layer creation process applies the appropriate individual layer properties to the created layers. However if there is a mismatch between the number of data items supplied and the number of layers created, there may be situations where this is not possible and the layers created will not have the individual properties applied.
Use this property to control the behavior of bulk layer creation in these scenarios.
If set to LayerCreationRollbackBehavior.NoRollback then no rollback will occur regardless of whether all layers are created and all layer properties are applied.
If set to LayerCreationRollbackBehavior.RollbackOnMissingLayers and there are instances where some layers cannot be created, then the layers that have been created will be removed and the end result will be that no new layers will be added to the TOC.
If set to LayerCreationRollbackBehavior.RollbackOnCannotApplyLayerProperties and there are instances where some layers cannot be created, AND the individual layer properties cannot be applied to the created layers, then the layers that have been created will be removed and the end result will be that no new layers will be added to the TOC.
var uriShp = new Uri(@"c:\data\roads.shp"); var uriSde = new Uri(@"c:\MyDataConnections\MySDE.sde\Census"); var uri = new Uri(@"http://sampleserver6.arcgisonline.com/arcgis/rest/services/NapervilleShelters/FeatureServer/0"); var lcpShp = new FeatureLayerCreationParams(uriShp); lcpShp.Name = "Roads"; lcpShp.IsVisible = false; lcpShp.DefinitionQuery = new DefinitionQuery("shpQuery", "OBJECTID > 10"); var lcpSde = new FeatureLayerCreationParams(uriSde); lcpSde.Name = "Census Polygons"; lcpSde.IsVisible = true; var lcpService = new FeatureLayerCreationParams(uri); lcpService.Name = "Shelters"; lcpService.IsVisible = true; // set some renderer here ... //lcpService.RendererDefinition = ... var lcps = new List<FeatureLayerCreationParams>(); lcps.Add(lcpShp); lcps.Add(lcpSde); lcps.Add(lcpService); var blkParams = new BulkLayerCreationParams(lcps); // set the positioning on the BulkLayerCreationParams blkParams.MapMemberPosition = MapMemberPosition.Index; blkParams.MapMemberIndex = 0; // set the rollback behavior // - rollback if one or more layers cannot be created due to an invalid data source blkParams.RollbackBehavior = LayerCreationRollbackBehavior.RollbackOnMissingLayers; var layers = LayerFactory.Instance.CreateLayers(blkParams, MapView.Active.Map);
Target Platforms: Windows 11, Windows 10