Select to view content in your preferred language

Legend Layer IDs

793
4
Jump to solution
08-29-2012 02:14 PM
TanyaOwens
Frequent Contributor
Hello,

Currently I have my legend setup showing specific layers with the layer IDs but some of the layers it is difficult to have spaces included because of other parts of my code for example. I have a layer set as SchoolZones to work with some of my code and I would like to to display on the legend as "School Zones". Is there a way to set which layer you want to display with the layer IDs and also include and alias on how to display the layers?

Thanks!
0 Kudos
1 Solution

Accepted Solutions
DominiqueBroux
Esri Frequent Contributor
I am using 2.4 right now (I am waiting for the SL Viewer update before I upgrade). Do you happen to have an example of the LayerItem? I am very new to programming so I am not sure on how to do this.

Thanks!


I am thinking about something like:

private void Legend_Refreshed(object sender, Legend.RefreshedEventArgs e) {   if (e.LayerItem.Label == "SchoolZones")     e.LayerItem.Label = "School Zones" }

View solution in original post

0 Kudos
4 Replies
DominiqueBroux
Esri Frequent Contributor
I have a layer set as SchoolZones to work with some of my code and I would like to to display on the legend as "School Zones". Is there a way to set which layer you want to display with the layer IDs and also include and alias on how to display the layers?



From 3.0, the Layer has a DisplayName property that can be used for that purpose.

With previous versions the workaround is to change the LayerItem Label on event Lgend.Refreshed.
0 Kudos
TanyaOwens
Frequent Contributor
From 3.0, the Layer has a DisplayName property that can be used for that purpose.

With previous versions the workaround is to change the LayerItem Label on event Lgend.Refreshed.


I am using 2.4 right now (I am waiting for the SL Viewer update before I upgrade). Do you happen to have an example of the LayerItem? I am very new to programming so I am not sure on how to do this.

Thanks!
0 Kudos
DominiqueBroux
Esri Frequent Contributor
I am using 2.4 right now (I am waiting for the SL Viewer update before I upgrade). Do you happen to have an example of the LayerItem? I am very new to programming so I am not sure on how to do this.

Thanks!


I am thinking about something like:

private void Legend_Refreshed(object sender, Legend.RefreshedEventArgs e) {   if (e.LayerItem.Label == "SchoolZones")     e.LayerItem.Label = "School Zones" }
0 Kudos
TanyaOwens
Frequent Contributor
Thank you so much!!!
0 Kudos