Select to view content in your preferred language

Retrieve LayerInfo problem.

1003
1
10-27-2011 07:40 AM
weiliang
Deactivated User
Hi,

I want to use LayerInfo for an ArcGISDynamicMapServiceLayer object after the MainPage is loaded. I used the MainPage Loaded event and MyMap Loaded event. In the event handler, I try to use the Layers attribute on the ArcGISDynamicMapServiceLayer object to retrieve its layer's info. However, the Layers info is null. So, my question is, which event should I use to make sure the layerinfo has been loaded successfully.

Thanks,

Wei
0 Kudos
1 Reply
JenniferNery
Esri Regular Contributor
ArcGISDynamicMapServiceLayer.Layers is available after the layer has been initialized.

private void ArcGISDynamicMapServiceLayer_Initialized(object sender, EventArgs e)
{
 var l = sender as ArcGISDynamicMapServiceLayer;
 if (l.Layers == null) return;
 foreach (var s in l.Layers)
 {
  //layer info here.
 }
}
0 Kudos