Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
EntityState Enumeration

EntityState Enumeration

Bing

Defines the highlighted or selected state of an entity, such as a pushpin. To get the latest Bing Maps entity state design, load the Microsoft.Maps.Themes.BingTheme module before creating your entity.

Constants

Name Description

highlighted

The entity is highlighted on the map.

none

The entity is not highlighted or selected.

selected

The entity is selected on the map.

Remarks

Two entity state values can be combined by using AND (&) or OR (|). For example, if a pin is selected and you want it to remain selected after a hover action, but un-highlighted if it is highlighted, then you can use myPin.setOptions({state:pin1.getState() & ~Microsoft.Maps.EntityState.highlighted});.

Example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title></title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

      <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>

      <script type="text/javascript">

      var map = null;

      function GetMap()
      {  

         Microsoft.Maps.loadModule('Microsoft.Maps.Themes.BingTheme', { callback: themesModuleLoaded });

      }

      

      function themesModuleLoaded() 
      {
         map = new Microsoft.Maps.Map(document.getElementById('mapDiv'), { credentials: 'Bing Maps Key', theme: new Microsoft.Maps.Themes.BingTheme() }); 

         var pin1 = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(34.05, -118.24), null); 

         map.entities.push(pin1); 
         map.entities.push(new Microsoft.Maps.Infobox(new Microsoft.Maps.Location(34.05, -118.24), {title: 'Los Angeles', description: 'Description here', pushpin: pin1})); 

         pin1.setOptions({state:Microsoft.Maps.EntityState.selected});

       }


      </script>
   </head>
   <body onload="GetMap();">
      <div id='mapDiv' style="position:relative; width:600px; height:600px;"></div> 
   </body>
</html>

See Also

Show:
© 2015 Microsoft