locked
Bing Maps on JavaScript windows 8 grid app

    Question

  • Hi, all

    Does anyone know, why Bing Maps doesn't work on Grid app windows 8? in this case the code is running well. But, Bing Maps doesn't appears..
    thanks in advance
    Sunday, October 21, 2012 1:54 PM

All replies

  • Can you provide more information or maybe a code sample?  I am using Bing Maps in my Grid app and I am not having any problems.

    Dave Paquette @Dave_Paquette www.davepaquette.com

    Sunday, October 21, 2012 5:39 PM
  • Hi, Dave Paquette

    In this case i build the application on javaScript windows 8 Grid app.. in my project, i use application bar.. one of the application bar button.. navigate to bing Maps page. which is i made before..
    Bing Maps doesn't appears when
    i was navigate to bing Maps page(Page Control) not HTML Page.. my code running well.. i guarantee that..
    but, when i try build the maps in Blank App.. its running well and work..
    I don't know exactly about that..

    this my code
    on bingMaps.html

    <body>
     <div id="mapdiv"></div>
    </body>

    on bingMaps.js

    app.onactivated = function (args) {
        if (args.detail.kind === activation.ActivationKind.launch) {
            if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) {
            } else {
            }
            args.setPromise(WinJS.UI.processAll().then(function () {
                Microsoft.Maps.loadModule('Microsoft.Maps.Map', { callback: initMap });
     }));
        }
    };

    function initMap() {
        try {
            var mapOptions =
            {
                credentials: "my key",
     center: new Microsoft.Maps.Location(50, 50),
                mapTypeId: Microsoft.Maps.MapTypeId.road,
                zoom: 5
            };
    
            var mapDiv = document.querySelector("#mapdiv");
     map = new Microsoft.Maps.Map(mapDiv, mapOptions);
        }
        catch (e) {
            var md = new Windows.UI.Popups.MessageDialog(e.message);
            md.showAsync();
        }
    }
    kind regard


    Monday, October 22, 2012 12:04 AM