I am using the Bing Maps AJAX Control 7.0
I would like to add a custom event handler to the pushpins that are part of a driving route.
I know how to add custom events to map entities I have created myself and have a reference to. But the entities that make up a driving route are created internally and automatically added to the map. Is there a way I can attach and event handler either before or after they are added to the map?
Specifically I would like to add a custom onmouseover event to the waypoint pushpins that are on the driving route so that a custom icon is displayed when hovered over. I have read a suggestion to add a css class with pseudo :hover selector to the pushpins through the typeName property in the PushpinOptions but this does not work. The AJAX control itself uses the javascript event to change the icon image on mouse over, so setting the background css property on :hover never works, it gets covered up by the default hover icon.
I need to add a custom onmouseover event to the driving waypoint pushpins so that I can display a custom icon and disable the default behaviour. How do I do this? Thanks.
I have discovered that there is an undocumented property of the
PushpinOptionsobject –hoverIconI added some code to the
directionsUpdatedevent of theDirectionsManagerobject that iterated through the entities on the map. I looked at theWaypointentities and saw they have both_iconand_hoverIconinternal properties. As there is aniconproperty in thePushpinOptionsI checked to see if ahoverIconproperty could be used as well, and it can!As far as I know the
hoverIconproperty is not documented. But this is a much easier way and probably the proper way to add a custom hover image to a pushpin.It would help if this was reported to Micorsoft so they can update their documentation. I have never reported a documentation error to Microsoft before so if you know the best way to do this please let me know.