Page Controls are not initialized yet and script is executing before that.
There is two place this code can be placed. either in
// if the app bar is part of default.html, appbar show can be put in default.js
// default.js already have a call to WinJS.UI.processAll under activated event handler
WinJS.UI.processAll().then(function ()
{
appbar.winControl.show();
});
or
// if the appbar is part of mypage.html, need to have code like this in mypage.js
WinJS.UI.Pages.define('/pages/mypage/mypage.html',
{
ready: function onready(element, options)
{
appbar.winControl.show();
}
}