There are two event styles available for a pushpin in Bing.
- enableHoverStyle : Boolean
- enableClickedStyle : Boolean
To see these events/styles in action, visit the link below:
My goal is to deselect an already selected pin when another pin is selected. Is there a way to achieve this?
Edited:
I have come up with a solution, although I'm not sure if it's the best one.
I set the event trigger on pushpin click.
Microsoft.Maps.Events.addHandler(pushpin, 'click', togglePinState);
Here is the togglePinState function:
function togglePinState(pinData){
if(pinData.target == null)
return;
if(selectedPin == null){
selectedPin = pinData.target;
selectedPin.setOptions({enableClickedStyle: true});
return;
}
if(pinData.target != selectedPin){
selectedPin.setOptions({enableClickedStyle: false});
selectedPin = pinData.target;
selectedPin.setOptions({enableClickedStyle: true});
}
}