none
windows 8 bing maps on javascript grid app RRS feed

  • 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

    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

    Wednesday, October 31, 2012 3:00 PM

Answers

  • Try setting the map width and height when displaying the map div. When it is collapsed the width and height are likely 0 and the map control continues to think that is the case and doesn't expand the map when you display it.

    http://rbrundritt.wordpress.com

    Friday, November 9, 2012 10:40 AM

All replies

  • What are you getting in map div. Is it is blank or there is js error? Could you see if the map code is hit while running app?

    Check Supported regions on http://msdn.microsoft.com/en-us/library/hh852186.aspx, as it provides any help?

    Thanks


    MSFT
    Hemant Goyal

    Friday, November 2, 2012 12:09 AM
  • Hi, Hemant Goyal

    Yes, map div is blank.. and the simple way i edit in .css and set the background color to black.. map div result to color.. thats mean.. map div is exist but, bing maps doesn't appears.

    Thanks i will check that out

    kind regard

    Friday, November 2, 2012 8:43 AM
  • Try setting the map width and height when displaying the map div. When it is collapsed the width and height are likely 0 and the map control continues to think that is the case and doesn't expand the map when you display it.

    http://rbrundritt.wordpress.com

    Friday, November 9, 2012 10:40 AM