This is an archive related to a previous version of Esri Maps for SharePoint. If you need the current version go to http://doc.arcgis.com/en/maps-for-sharepoint/.
When designing and displaying dialog boxes in your map application, there are many factors to consider, such as how to display the user interface (UI); the overall design and theme; how to achieve smooth integration with the existing application framework; and whether there are actions you want to perform as the dialog box is closing or once it has closed, such as removing a layer from the map.
To display the UI (dialog box) within the Map Web Part, the extensibility application programming interface (API) provides two methods—ShowWindow and HideWindow. These methods are available from MapApplication.Current. The MapApplication.Current.ShowWindow method displays any FrameworkElement in a floating dialog box. Pass the object you want to display with the title of the dialog box as a string to the ShowWindow method to display a dialog box. The ShowWindow method optionally accepts a Boolean to determine whether the dialog box is modal, an event handler that is called when the dialog box has started closing, and a second event handler that is called when the dialog box completes closing. To close the dialog box, pass the same FrameworkElement to the MapApplication.Current.HideWindow method.
If you are implementing a command, display the UI as soon as the button is clicked (that is, the command is executed). If your command requires the user to interact with the map, the UI should indicate this.
When using ShowWindow, set the background of your UI to be transparent. The dialog box containing your UI will base its background color on the application’s theme colors, which are configurable by users who are designing the application.
For an example of displaying the Silverlight UI in the ArcGIS Map Web Part, suppose that you have implemented the UserControl with the default code-behind class and the Extensible Application Markup Language (XAML) as follows:
<Grid x:Name="LayoutRoot" Background="Transparent">
<TextBlock Text="This is my Silverlight UI!" Margin="20" />
A tool that shows this control in a dialog box when the tool is executed would be implemented as follows:
[DisplayName("Show A Simple Dialog")]
[Description("Tool to show a simple dialog")]
[DefaultIcon("<Insert path to icon>")]
public class ShowDialogCommand : ICommand
private SimpleDialog dialog = null;
public void Execute(object parameter)
// Instantiate a new dialog if one does not already exist.
dialog = dialog ?? new SimpleDialog();
// Display the dialog.
MapApplication.Current.ShowWindow("Simple Dialog", dialog);
public bool CanExecute(object parameter)
// Return true so that the command is always enabled.
public event EventHandler CanExecuteChanged;
In a Map Web Part that has the default theme, this dialog box appears as follows:
Use layout customization to add UI (for example, panels) to the application that you don’t want to appear in a floating dialog box. If the UI should always be visible, include it in the layout. To give the user the ability to turn the UI on and off, you can do the following:
Do not programmatically walk the visual tree to dynamically add elements to the application. This approach requires the visual tree to be structured a particular way, and is thus inherently brittle. Code that does this may break from layout to layout and release to release.
The Extensibility assembly includes a set of brushes that are used within the ArcGIS Map Web Part. Use the built-in brushes to color your UI. This keeps the colors of your UI consistent with those of the application and allows end users to configure them through the theme controls.
The following brushes are available:
To initiate an action when a window shown by your add-in is closed, pass an event handler to the onHidingHandler or onHideHandler parameter of the MapApplication.Current.ShowWindow method.