ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / FeatureLayer Class / SetUseSymbolLayerDrawing Method
Set to true to use symbol layer drawing

In This Topic
    SetUseSymbolLayerDrawing Method (FeatureLayer)
    In This Topic
    Sets whether Symbol Layer Drawing will be used on the feature layer or not. This method must be called on the MCT. Use QueuedTask.Run.
    public void SetUseSymbolLayerDrawing( 
       bool useSLD
    Public Sub SetUseSymbolLayerDrawing( _
       ByVal useSLD As Boolean _


    Set to true to use symbol layer drawing
    This method or property must be called within the lambda passed to QueuedTask.Run.
    SLD has not been added to this layer or a parent
    SLD is being controlled by a parent group layer
    Calling SetUseSymbolLayerDrawing(useSLD) on a feature layer that does not have SLD added, or on a feature layer that is part of a group layer using SLD, will throw an System.InvalidOperationException. Use HasSymbolLayerDrawingAdded to determine if the layer has SLD added or participates in a parent group layer with SLD added.
    Enable/Disable SLD
    QueuedTask.Run(() =>
      //A layer may have SLD added but is not using it
      //HasSymbolLayerDrawingAdded returns a tuple - to check
      //the layer has SLD (not its parent) check addedOnLayer
      if (featLayer.HasSymbolLayerDrawingAdded().addedOnLayer)
        //the layer has SLD but is the layer currently using it?
        //GetUseSymbolLayerDrawing returns a tuple - useOnLayer for 
        //the layer (and useOnParent for the parent layer)
        if (!featLayer.GetUseSymbolLayerDrawing().useOnLayer)
          //enable it
      //Enable/Disable SLD on a layer parent
      if (featLayer.HasSymbolLayerDrawingAdded().addedOnParent)
        //check parent...this can be recursive
        var parent = GetParentLayerWithSLD(featLayer.Parent as GroupLayer);
        if (parent.GetUseSymbolLayerDrawing().useOnLayer)
       //Recursively get the parent with SLD
       public GroupLayer GetParentLayerWithSLD(GroupLayer groupLayer) 
         if (groupLayer == null)
           return null;
         //Must be on QueuedTask
         var sld_added = groupLayer.HasSymbolLayerDrawingAdded();
         if (sld_added.addedOnLayer)
           return groupLayer;
         else if (sld_added.addedOnParent)
           return GetParentLayerWithSLD(groupLayer.Parent as GroupLayer);
         return null;

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also