I want to change the text color of an Annotation Layer based on layer visibility.
Annotation Text shown here in yellow.
The yellow text does not change. I can change certain properties, like minScale, but I cannot add a labelingInfo class.
some info about the layer
Display Field: TEXTSTRING
Type: Annotation Layer
Has Labels: false
Can Modify Layer: false
Can Scale Symbols: true
Type ID Field: AnnotationClassID
Fields:
Here is my map
Here is my basic labelClass that will be added on layer visibility
The target layer. labelingInfo is null
watch event to add the labelClass
Gregory,
No you will not be able to change the annotations color in JS code. You are using a MapImageLayer (i.e. a picture drawn by ArcGIS Server) so there is no ability to change the annotations color since that is controlled by ArcGIS server and the MXD settings for that Anno layer.
Thanks Robert. Due to this limitation, the way I am handling this is by creating two listitems, one with black font color and the other with yellow, then toggling their listMode and visibility states.
Yellow font color looks really good on the aerials, but not on the beige background of basemaps. The yellow font is difficult to see. This is when I want to use the black font color.
Using two different layer listitems (black font and yellow), and watchUtils, I toggle the two aerial layers so only one will be checked in my LayerList design. Then I iterate over the listitems and set their listMode and visibility based on the font I want to use.
Black font color Yellow font color