Select to view content in your preferred language

Lable Toggle

2736
1
Jump to solution
02-12-2014 11:05 AM
LanceCrumbliss
Frequent Contributor
Hi there,

With the new dynamic labeling in v3.2, is possible to actually toggle the visibility of labels (and not just for point features), not just set their placement location?

Lance
0 Kudos
1 Solution

Accepted Solutions
DominiqueBroux
Esri Frequent Contributor
In order not to see the label you can set the LabelClasses to null.

For example starting from the dynamic labelling sample, you can toggle the labels visibility with code like:

private LabelClassCollection _labelClasses; private void ToggleLabels_OnClick(object sender, RoutedEventArgs e) {     ArcGISDynamicMapServiceLayer dynamicLayer = MyMap.Layers["PopulationDynamicLayer"] as ArcGISDynamicMapServiceLayer;      if (_labelClasses == null)     {         _labelClasses = dynamicLayer.LayerDrawingOptions[0].LabelClasses;         dynamicLayer.LayerDrawingOptions[0].LabelClasses = null;     }     else     {         dynamicLayer.LayerDrawingOptions[0].LabelClasses = _labelClasses;         _labelClasses = null;     }     dynamicLayer.Refresh(); }

View solution in original post

0 Kudos
1 Reply
DominiqueBroux
Esri Frequent Contributor
In order not to see the label you can set the LabelClasses to null.

For example starting from the dynamic labelling sample, you can toggle the labels visibility with code like:

private LabelClassCollection _labelClasses; private void ToggleLabels_OnClick(object sender, RoutedEventArgs e) {     ArcGISDynamicMapServiceLayer dynamicLayer = MyMap.Layers["PopulationDynamicLayer"] as ArcGISDynamicMapServiceLayer;      if (_labelClasses == null)     {         _labelClasses = dynamicLayer.LayerDrawingOptions[0].LabelClasses;         dynamicLayer.LayerDrawingOptions[0].LabelClasses = null;     }     else     {         dynamicLayer.LayerDrawingOptions[0].LabelClasses = _labelClasses;         _labelClasses = null;     }     dynamicLayer.Refresh(); }
0 Kudos