Compartir a través de


Infobox Class

Note

Bing Maps Web Control SDK retirement

Bing Maps Web Control SDK is deprecated and will be retired. Free (Basic) account customers can continue to use Bing Maps Web Control SDK until June 30th, 2025. Enterprise account customers can continue to use Bing Maps Web Control SDK until June 30th, 2028. To avoid service disruptions, all implementations using Bing Maps Web Control SDK will need to be updated to use Azure Maps Web SDK by the retirement date that applies to your Bing Maps for Enterprise account type. For detailed migration guidance, see Migrate from Bing Maps Web Control SDK and Migrate Bing Maps Enterprise applications to Azure Maps with GitHub Copilot.

Azure Maps is Microsoft's next-generation maps and geospatial services for developers. Azure Maps has many of the same features as Bing Maps for Enterprise, and more. To get started with Azure Maps, create a free Azure subscription and an Azure Maps account. For more information about azure Maps, see Azure Maps Documentation. For migration guidance, see Bing Maps Migration Overview.

An infobox, also sometimes refer to as an info window or popup, is a simple panel that displays information over top the map. This is often used to display information linked to a location after clicking on a pushpin.

Constructor

Infobox(location: Location, options?: InfoboxOptions)

When creating an infobox a location must be passed as an argument to the constructor. Optionally, infobox options can also be passed in as an argument.

Methods

Here is a list of methods available in the Infobox class.

Name Return Type Description
getActions() InfoboxActions[] Returns a list of the infobox actions, where each item is a label (the link text) or icon (the URL of the image to use as the icon link) and eventHandler (name of the function handling a click of the action link). Note that this is not supported when using htmlContent, use HTML anchors instead.
getAnchor() Point Returns the point on the infobox which is anchored to the map. An anchor of (0,0) is the top left corner of the infobox.
getDescription() string Returns the string that is printed inside the infobox.
getHeight() number Returns the height of the infobox.
getHtmlContent() string Returns the infobox as HTML.
getLocation() Location Returns the location on the map where the infobox’s anchor is attached.
getMaxHeight() number Gets the maximium height setting for the infobox.
getMaxWidth() number Gets the maximium width setting for the infobox.
getOffset() Point Returns the amount the infobox pointer is shifted from the location of the infobox, or if showPointer is false, then it is the amount the infobox bottom left edge is shifted from the location of the infobox. The default value is (0,0), which means there is no offset.
getOptions() InfoboxOptions Returns the infobox options.
getShowCloseButton() boolean Returns a boolean indicating whether the infobox close button is shown.
getShowPointer() boolean Returns a boolean indicating whether the infobox is drawn with a pointer.
getTitle() string Returns a string that is the title of the infobox.
getVisible() boolean Returns whether the infobox is visible. A value of false indicates that the infobox is hidden, although it is still an entity on the map.
getWidth() number Returns the width of the infobox.
getZIndex() number Gets the z-index of the infobox.
setHtmlContent(content: string) Sets the HTML content of the infobox. You can use this method to change the look of the infobox. Note that infobox options are ignored if custom HTML is set. Also, when custom HTML is used to represent the infobox, the infobox is anchored at the bottom-left corner.
setLocation(loc: Location) Sets the location on the map where the anchor of the infobox is attached.
setMap(map: Map) Adds the infobox to the map. To remove an Infobox from the map, simply pass null into this function. Note: Calling this function removes all event handlers from the infobox. Add your event handlers to the infobox after calling this function.
setOptions(opt: InfoboxOptions, ignoreDelay?: boolean) Sets options for the infobox. If the ignoreDelay parameter is set to true, the closeDelayTime option will be ignored if the visible option is being changed from true to false.

Events

Name Arguments Description
click InfoboxEventArgs Occurs when the mouse is used to click the infobox.
infoboxChanged InfoboxEventArgs Occurs when the locations/rings or options of the polygon has changed.
mouseenter InfoboxEventArgs Occurs when the mouse cursor enters the infobox area.
mouseleave InfoboxEventArgs Occurs when the mouse cursor moves out of the infobox area.

See Also