Extending the ArcGIS Viewer for Silverlight
Add-ins and the Extensibility API
The ArcGIS Viewer for Silverlight allows you to develop custom functionality by creating add-ins. Add-ins are Silverlight assemblies that contain one or more tools or map behaviors that interact with the Viewer. To help you write add-ins, the Viewer provides a lightweight and flexible extensibility application programming interface (API) included in the ArcGIS Extensibility SDK for Silverlight. The API provides Viewer developers access to the map and selected layer, methods to show user interfaces (UI) in dialog boxes, and the ability to store and load configuration data. All the functionality exposed by the extensibility API is available in the ESRI.ArcGIS.Client.Extensibility assembly. To take advantage of this functionality, add a reference to this assembly to your Visual Studio project.
While the extensibility API provides a few simple points of interaction with the Viewer, what you can include in an add-in is very open-ended. Within an add-in, you may leverage any Silverlight library, including the ArcGIS API for Silverlight and the native Silverlight API. You are free to manipulate the map and layers, display any Silverlight UI, make your components configurable, interact with other Silverlight or JavaScript components on the page, make calls to web services such as those provided by SharePoint or ArcGIS Server, and much more.
Once you have written an add-in, add the compiled Silverlight Application (.xap file) to the Application Builder using the Settings page, then when creating or editing your Viewer application, you can add the tools and behaviors contained in your add-in through the Add Tool and Manage dialog boxes. See Adding and managing tools and toolbars. Tools that are added are surfaced as buttons on the toolbar. Behaviors that are added are enabled when the Viewer loads and can be managed through the Map Behaviors dialog box.
To add an add-in to the Viewer, see the following steps:
- Create your add-in, referencing the Creating a tool and Creating a map behavior topics as needed.
- Open the Application Builder and open a saved Viewer application or create a new one.
- Click Settings in the upper-right corner.
- On the Settings page, click the Add-Ins tab.
- Click Upload Add-Ins, navigate to your compiled Silverlight Application (.xap file), and click Open.
- The add-in is added to the Application Builder. Click the name of the add-in or the Details button to see the add-ins included in the add-in package you have uploaded.
- Click the Back button in the upper-right corner to return to the Application Builder.
Best practices
This help system includes a series of topics on best practices for developing add-ins for the ArcGIS Viewer for Silverlight. These topics include subjects such as determining whether to develop a tool or behavior, design of dialog boxes and UI, how to handle map interaction such as mouse clicks, symbolizing and rendering graphics layers, and creating add-ins that can be configured. Please see the following topics: