ThinkGeo.com    |     Documentation    |     Premium Support

Hiding Labels

I would like to allow the user to show or hide the labels on one of my layers. I have played around with this trying to figure it out and I searched on here as well. I can't find it now, but it seems that when I searched before I found a post about putting the labels on a different layer. Perhaps I'm misunderstanding this, but does that mean I have to duplicate all my items from the one layer to the other layer and then just show only labels on one and only the marker on the other? I imagine there must be a better way.


Thank you!


Kimberly



Kimberly, 
  
 We recommend using separate layers, one for markers and the other is just for labeling. You are right that there are duplicates but it’s worthy for the benefits it brings. For a single layer, it’s fine to render the markers and labels within one layer as the label will always display on top of the marker. However, if there are many layers need labeling, it’s difficult to manage the label order using the old way. So we came up with that idea that with a bit duplicated codes, you can easily control the label order and for your case, you can easily turn on/off one label by simply set the property labellayer.IsVisible to true/false. 
  
 Many of our samples are using separate layers for labeling, please have a look the sample Labeling->DrawAndLabelANiceLookRoads for example. 
  
 Let me know if you have any issues. 
  
 Thanks, 
  
 Ben 


Thank you for the response, Ben. I guessed that might be the answer, but thanks for clarifying! 
  
 Kimberly

Great it hepls, let me know is you have any issues.