Select to view content in your preferred language

Legend Initialize Method

467
1
08-07-2011 11:48 AM
SeanFairhurst
New Contributor
I'm trying to use the Legend programatically before it has been viewed by the user.  But it's LayerItem count = 0 until it's been exposed to the user in the application.  Is there some other way to initialize the Legend object for use in the code behind?
0 Kudos
1 Reply
DominiqueBroux
Esri Frequent Contributor
The template of a control is only applied whether the control is in the visual tree and is visible.
So the behavior you mentionned is normal.

The workaround might be to set the legend as visible by default and then set it to 'Collapsed' on event 'Loaded'.
0 Kudos