This is an archive related to a previous version of Esri Maps for SharePoint. If you need the current version go to

Best practices: Creating configurable add-ins

The ArcGIS Extensibility SDK for Silverlight provides the ability to make your tools and behaviors configurable. If a tool or behavior is configurable, you can configure the component in the Map Web Part. To expose configuration on a tool or behavior, you need to implement the ESRI.ArcGIS.Client.Extensibility.ISupportsConfiguration interface. This interface requires you to implement the following methods:

  • Configure—Invoked when a designer clicks the configure button for the tool or behavior. Your configuration logic should be initiated here. Usually, this involves displaying a dialog box to get input from the designer.
  • SaveConfiguration—Invoked when the input is saved. The string you return from this method is persisted and passed back to the command or behavior when the tool is loaded.
  • LoadConfiguration—Invoked when the tool initializes. The last string you returned from SaveConfiguration is passed to this method.

For an example of a configurable tool, suppose you have implemented a UserControl that contains the default code-behind and a text box. The Extensible Application Markup Language (XAML) for this control may appear as follows:

<UserControl x:Class="MyExtension.ConfigurationDialog"
     d:DesignHeight="300" d:DesignWidth="400">
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <StackPanel Margin="10" Background="Transparent">
            <TextBlock Text="Configuration Input:" Margin="0,0,0,5" />
            <TextBox Name="InputTextBox" Width="200" />

This control could be used in a configurable tool as follows:

[DisplayName("Configurable Command")]
[Category("My Tools")]
[Description("Example of a configurable command")]
[DefaultIcon(Path to icon, ex: "/Viewer.Addins;component/Images/Identify.png")]
public class ConfigurableCommand: ICommand, ISupportsConfiguration
        private ConfigurationDialog configDialog = new ConfigurationDialog();

        #region ISupportsConfiguration Members

        public void Configure()
            // When the dialog box opens, it shows the information saved from the last 
												//time the command was configured.
            MapApplication.Current.ShowWindow("Configuration", configDialog);

        public void LoadConfiguration(string configData)
            // If the saved configuration is not null, apply it to the configuration dialog box.
            configDialog.InputTextBox.Text = configData ?? "";

        public string SaveConfiguration()
            // Save the information from the dialog box, and 
            return configDialog.InputTextBox.Text;


        #region ICommand Members

        public bool CanExecute(object parameter)
            // Return true so that the command can always be executed.
            return true;

        public event EventHandler CanExecuteChanged;

        public void Execute(object parameter)
            // Show the configuration data. 
            MapApplication.Current.ShowWindow("Configuration", new TextBlock()
                Text = configDialog.InputTextBox.Text,
                TextWrapping = TextWrapping.Wrap,
                Margin = new Thickness(30),
                MaxWidth = 480


With this command added to the ArcGIS Map Web Part, designers editing the web part initiate configuration by selecting Configure from the command's menu.

Configure button on Configurable Command drop-down menu

Clicking Configure invokes the command's Configure method. With the implementation previously shown, this displays the following dialog box:

Configuration dialog box

When the ArcGIS Map Web Part is saved, the text in the text box is persisted as a string. When the ArcGIS Map Web Part loads, this string is passed to the LoadConfiguration method and used to initialize the configuration String variable. Executing the command—by clicking the command's button—displays a message box that shows the saved configuration string.

Dialog box with saved configuration string