ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / FeatureLayer Class / SetLabelVisibility Method
true make labels to draw.
Example

In This Topic
    SetLabelVisibility Method (FeatureLayer)
    In This Topic
    Toggles the feature layer's label's visibility. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public void SetLabelVisibility( 
       bool isLabelVisible
    )
    Public Sub SetLabelVisibility( _
       ByVal isLabelVisible As Boolean _
    ) 

    Parameters

    isLabelVisible
    true make labels to draw.
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Enable labeling on a layer
    var featureLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault();
    ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
    {
      // toggle the label visibility
      featureLayer.SetLabelVisibility(!featureLayer.IsLabelVisible);
    });
    Enable labeling of a layer
    //Note: call within QueuedTask.Run()
    
    if (!featureLayer.IsLabelVisible)
      //set the label's visiblity
      featureLayer.SetLabelVisibility(true);
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also