MapTips control


In this topic


About the MapTips control

The MapTips control enables an associated Map control to display attributes of a feature when you hover the cursor over a map feature. A MapTips control is associated with a single Map control via the Map property. The properties of the MapTips control determine the layer that displays when using MapTips and how information about the features show.
The MapTips control supports point, line, and polygon layers accessible via ArcGIS Server, ArcIMS, and Web Application Developer Framework (ADF) graphic map resources. If the data source is a remote service (for example, ArcGIS Server and ArcIMS) the map service must return feature geometry.  
MapTips are rendered in the client browser using Web ADF JavaScript library classes and functionality. The Web ADF JavaScript MapTips class associates graphic features (symbology and geometry) with callout windows. When you hover the cursor over a graphic feature on the map, a callout window appears with attribute information related to the feature. By default, no Web request to the Web application on the server is necessary to display the callout (MapTips' content resides solely within the Web browser's memory). 
For more information about the MapTips control, see Working with the MapTips control.

Using the control

  1. Open or create a Web site in Visual Studio. Open a Web form in design mode, select the Toolbox panel, and expand the ArcGIS Web Controls tab. Drag and drop a MapResourceManager, a Map control, and a MapTips control onto the Web form. The placement of the MapTips control is not important, as it is not visible to the user. Add one or more resources to the MapResourceManager. Also set the Map control's MapResourceManager property to Map1. See the following screen shot that shows the added controls in Visual Studio:


  2. Select the MapTips' control to set its control properties. Do the following on the Properties window:
    1. Set the Map property to the name of the Map control previously created and configured. 
    2. Set the FeatureLimit property, which defines the maximum number of features rendered as MapTips at runtime. This value can be limited by the service underlying the map resource. For example, by default, ArcGIS Server map services are limited to returning 500 features at a time. To change this value, modify the MaxRecordCount property in the service configuration file (.cfg). For more information, see Service configuration files.  

      See the following screen shot that shows the Properties window:


    3. Set the Layer property for the map layer used for MapTips. On the Properties window, click the value area for the Layer property, then click the ellipsis button. The MapTips Layer Editor dialog box appears. You can also access this dialog box from the MapTips control on the page, by clicking the arrow in the upper right of the control (smart tag), and choosing Set Layer.
      • On the MapTips Layer Editor dialog box, click the Resource Manager drop-down list to set the resource manager to the one previously added.
      • Click the Resource drop-down list to set the resource to the resource added in the Resource Manager field, then set the layer to one of the available layers. 
      • Click OK to close the dialog box and set the Layer property.

        See the following screen shot of the MapTips Layer Editor dialog box:


    4. Click the smart tag arrow on the MapTips control to show the smart tag menu. See the following screen shot that shows the smart tag menu on the MapTips control:


    5. Click Set MapTips LayerFormat on the smart tag menu. The following MapTips Expression Editor dialog box appears with three tabs (Symbols, Fields, and Records):



      • Symbols tab—Enables you to define the default and highlight symbol for features on which MapTips have been configured. Click the "Draw with" or "Highlight with" button to change the symbol. When MapTips are generated from the selected layer at runtime, features are rendered in the Web browser using the default (Draw with) symbol. When you hover the cursor over a feature, the highlight symbol (Highlight with) displays. The feature type of the layer determines the options for changing the symbol. 

        Point feature layers display a dialog box containing marker symbols. Select the symbol (the selected symbol shows in the bottom left corner on the dialog box). You can modify the marker symbols on the dialog box by adding and removing items in the formatted .xml usersymbols.config file in the <IISROOT>/aspnet_client/ESRI/WebADF/MarkerSymbols folder. Open the usersymbols.config file in a text editor and use the description in the file's header to define the appropriate format for adding items. The same folder contains a symbols.config file with references to default marker symbols included with the Web ADF.

        Do not edit the symbols.config file since it can change in future releases.

        Line feature layers show a dialog box to change the color, width, and transparency of the symbol. Click the color box to display a color picker. Colors can be defined using red, green, and blue (RGB) or hue, saturation, and luminance combinations. Transparency values range from opaque (0) to completely transparent (100).

        Polygon feature layers show a dialog box to change the boundary color, width, transparency, and the fill color and transparency. Click the color box to display a color picker. Colors can be defined using RGB or hue, saturation, and luminance combinations. Transparency values range from opaque (0) to completely transparent (100).
      • Fields tab—Displays the fields in the MapTips layer and defines the field visibility and field name shown in the MapTips callout window. Select a check box next to each field name to set the field visibility. You can also edit the text in the Alias field if you do not want to use the original field name. 

        The "Primary display field" is used to describe the contents of a record. It is set to a field that contains an intuitive and preferably unique value to identify an attribute. Click the drop-down list to select the value for the primary display field. 

        The default values on the Fields tab reflect the field aliases, visibility, and primary display field that you set in the configuration file (for example, map document [.mxd file]) for the map service. The values added on this dialog box overrides these settings in the current Web application. If you want the fields to appear the same way in multiple Web applications, set the field properties in the map service configuration file instead of resetting them in each Web application.

        See the following screen shot that shows the Fields tab on the MapTips Expression Editor dialog box:


      • Records tab—Shows the tabular format for MapTips as displayed in the callout in the Web browser at runtime. By default, visible fields are included in the record display as name value pairs and the title is the primary display field. To customize the record display, click the "Custom formatting" radio button. The Title and Contents sections of the dialog box are now editable. The Contents section has a rich text editor to modify the font style and color, or to add fields, hyperlinks, tables or images. Edits are stored as Hypertext Markup Language (HTML) style content to render in the Web browser at runtime. The fields whose values display in the title and content of the MapTips callout are included in brackets, for example {<field name>}.

        See the following screen shot that shows the Records tab on the MapTips Expression Editor dialog box:  



        The rich text editor toolbar contains a set of tools to enhance how records show on the MapTips callout window. The following screen shot shows the title for each tool on the toolbar:



        Font style settings—Enables you to modify text in the contents display. 

        Add Field tool—Has a list of fields in the MapTips layer that can be added to the contents display.  

        Add Hyperlink tool—Adds a hyperlink to selected text or field values. 

        Add Table tool—Adds an HTML table to the contents display, which can be used to arrange and organize content. 

        Add Image tool—Adds an image (img) tag and enables you to define the uniform resource locator (URL) to an image. The URL can be constructed from a field value. 

        To view HTML content that will be used to format layer results, click the HTML radio button at the bottom of the dialog box. The raw HTML content shows in the Content window. Valid content that renders in a Web browser can be added, including HTML, Cascading Style Sheets (CSS) definitions, and JavaScript. 

        For more information, see the Set title and content using HTML section in the topic, Working with the MapTips control.
    6. After setting the MapTips layer format via the expression, click OK to close the dialog box and save the settings. The layer format is saved as a JavaScript Object Notation (JSON) formatted string to the Layer property on the MapTips control.

      Additional properties can be configured to change how MapTips behave at runtime. For more information on property settings, see the Members section.
  3. At runtime, MapTips render on the map as client graphic features. When you hover the cursor over a graphic feature, the MapTips title displays. Click the MapTips title to show the contents.

    See the following screen shot that shows the MapTips content over a graphic feature:

Members

The following table shows a list of properties related to the MapTips control. For more reference information, see the MapTips control in the library reference section.
Property name
Type
Description
FeatureLimit
int
Maximum number of MapTips shown on the map. This value can be limited by the service underlying the map resource. For example, by default, ArcGIS Server map services are limited to returning 500 features. To change this value, modify the MaxRecordCount property in the service configuration file (.cfg). 
Layer
string
Layer, MapResourceManager, and resource for which MapTips display.
Map
string
ID of the Map control in which the MapTips display.
ShowOnlyWhenLayerIsVisible
bool
Determines if MapTips show when the layer is visible and not when the layer is turned off or invisible due to scale factor settings.
WhereClause
string
Shows MapTips only for features matching the expression.


See Also:

Working with the MapTips control
Web ADF controls
Service configuration files




To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
  • ESRI.ArcGIS.ADF.Web.UI.WebControls.dll