none
reset old polygon style on clicking new polygon i.e fill color moves to new selection

    Question

  • How do I reset the fill color of the previous or all polygons after changing on click event. So the colour can fill the newly clicked polygon. For example in the code below:

    Microsoft.Maps.loadModule('Microsoft.Maps.GeoJson', function () { var featureCollection = Microsoft.Maps.GeoJson.read(getCountriesGeoJson(), { polygonOptions: { fillColor: 'rgba(0, 255, 255, 0.0.3)'} }); for (var i = 0; i < featureCollection.length; i++) { map.entities.push(featureCollection[i]); // Add event handler to geoxml layer Microsoft.Maps.Events.addHandler(featureCollection[i], 'click', function (e) {

    //Reset previously clicked polygon back to original style here? featureCollection.resetStyle();

    ///////////////

    e.target.setOptions({ fillColor: 'red' }); }); } });


    • Edited by HKimani Monday, October 29, 2018 2:55 PM
    Monday, October 29, 2018 2:52 PM

All replies