2

Been using Esri JavaScript for a while but just started trying out the silverlight API but things are not going smoothly!

Tasks that I used to accomplish easily with Javascript is now proving unreasonably long and even unsolvable when using silverlight.

I am looking to create a little tool to add to the silverlight viewer. The tool interface has a listBox a Button and a ComboBox.

The logic is that The listBox will have hard-coded serviceURL's. User selects a serviceURL, clicks on the button and the tool display the layers/map information in the comboBox.

JavaScript did this easily with GetResourceInfo etc but I just don't know where or how to carry this out with SilverLight.

Any help will be very much appreciated.

1 Answer 1

1

In the Silverlight API, downloading of the service information is not exposed directly. Instead, it is encapsulated in the concrete layer type.

E.g. for dynamic AGS services, you need to create an instance of ArcGISDynamicMapServiceLayer, set the Url property and Initialize the layer. Keep in mind that the initialization is asynchronous (and involves downloading of the service description JSON) and fires the Initialized event (also see the InitializationFailed event).

Once the layer is correctly initialized, you can access the service information in a structured manner, which is exposed via the layer properties - e.g. the Layers property.

If more complete information is needed, you may have to also call the GetAllDetails method. It is also asynchronous, this time not via events, but via a completion callback, which provides you with the full description of every layer/table in the service.

1
  • Thanks Petr for getting back to me. Though this has given me an insight I still can't seem to get it right. The ESRI silverlight API site has a sample link. This works great. Pretty much what I want to do but the only issue is extending this to tell if the URL provided is for a Dynamic map service or a Tiled map service and drawing it accordingly. Happy if you could help with a little code.
    – bluerace
    Commented May 26, 2012 at 17:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.