BMv7.CustomInfobox - Can I add a CustomInfobox to its own layer?


  • After stumbling through the new theme and its lack of useful support for custom HTML infoboxes I've found Ricky Brundritt's BMv7.CustomInfobox, which I might add is very slick.

    Previously, I've read that best practices is to put the one infobox on its own layer and have each pin set its location and content. I've got multiple layers for pins that are fed by Ajax.

    Question is: With the CustomInfobox module is this still possible or do I need to change my show/hide layer function to a show/hide CustomInfobox?

    Current (non-working) code:
    function createInfoBoxLayer(){
        var customOptions = {
            orientation: 0,
            color: '#ccc',
            arrowWidth: 18,

        infoboxLayer = new Microsoft.Maps.EntityCollection();                                                                 //  create layer entity
        map.entities.push(infoboxLayer);                                                                                                 // add layer entity to map

        Microsoft.Maps.registerModule("CustomInfoboxModule", "scripts/V7CustomInfobox.min.js");            //Register and load the Custom Infobox Module
        Microsoft.Maps.loadModule("CustomInfoboxModule", { callback: function () {
               customInfobox = new CustomInfobox(map, customOptions)}    //Create an instance of the custom infobox control and set intial options

        infoboxLayer.push(customInfobox);                                                                                                        // add infobox entitity to infobox layer

    Previous code:
        infoboxLayer = new Microsoft.Maps.EntityCollection();
            weatherLayer = new Microsoft.Maps.EntityCollection();
        var infoboxOptions = {
            visible: false
        infobox = new Microsoft.Maps.Infobox(new Microsoft.Maps.Location(0, 0), infoboxOptions);
        Microsoft.Maps.Events.addHandler(infobox, 'click', hideinfoboxLayer);

    Friday, April 26, 2013 6:17 PM


  • You would have to modify the base module as it automatically adds it to a list. Note you can use the same custom infobox control for all data from all layers. Simply add the layers for the other data to the map first. If that doesn't work you can also use the zIndex property of the layers.

    Thursday, May 02, 2013 4:53 PM