Public Sub SetLabelVisibility( _ ByVal isLabelVisible As Boolean _ )
public void SetLabelVisibility( bool isLabelVisible )
Parameters
- isLabelVisible
- true make labels to draw.
Public Sub SetLabelVisibility( _ ByVal isLabelVisible As Boolean _ )
public void SetLabelVisibility( bool isLabelVisible )
| Exception | Description |
|---|---|
| ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
{
//Note: needs to be called on the MCT
// toggle the label visibility
featureLayer.SetLabelVisibility(!featureLayer.IsLabelVisible);
}
{
var cimMap = MapView.Active.Map.GetDefinition();
CIMTextSymbol simpleTextSymbol = SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.GreenRGB, 8.5, "Corbel", "Regular");
var lyrDefn = theLayerToLabel.GetDefinition() as CIMFeatureLayer;
//Get the label classes - we need the first one
var listLabelClasses = lyrDefn.LabelClasses.ToList();
var theLabelClass = listLabelClasses.FirstOrDefault();
//Place all labels horizontally
theLabelClass.StandardLabelPlacementProperties.LineLabelPosition.Horizontal = true;
//theLabelClass.MaplexLabelPlacementProperties.AlignLabelToLineDirection = true;
//Set the label classes' symbol to the custom text symbol
theLabelClass.TextSymbol.Symbol = simpleTextSymbol;
lyrDefn.LabelClasses = listLabelClasses.ToArray(); //Set the labelClasses back
theLayerToLabel.SetDefinition(lyrDefn);
(theLayerToLabel as FeatureLayer).SetLabelVisibility(true);
}
/// <summary> { // Note: call within QueuedTask.Run() { if (!featureLayer.IsLabelVisible) //set the label's visibility featureLayer.SetLabelVisibility(true); } }
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)