I'm working on a Windows 8.1 app and on a data input page I would like the appBar to be open or visible by default as it contains the option to save the data.
http://msdn.microsoft.com/en-us/library/windows/apps/br229676.aspx
I've looked at the link above and tried the show method in the following way:
Markup:
<div id="appbarCommands" data-win-control="WinJS.UI.AppBar" data-win-options="{sticky: 'true'}">
<button data-win-control="WinJS.UI.AppBarCommand"
data-win-options="{id:'cmdSaveCustomer', icon:'save', section:'global'}"
data-win-res="{winControl: {label:'CRM_contactHistory_appBar_SaveLabel', tooltip:'CRM_contactHisory_appBar_SaveToolTip'}}"></button>
</div>
JS Code:
(function () {
"use strict";
WinJS.UI.Pages.define("/pages/CRM/customerDetails/contacts/contactHistory/contactHistory.html", {
ready: function (element, options) {
WinJS.UI.processAll().done(function () {
setAppBarState(document.getElementById("appbarCommands"));
});
WinJS.Resources.processAll()
}
});
})();
function setAppBarState(appBar) {
appBar.winControl.show();
}
For whatever reason, the appBar doesn't launch. I've tested it in the appBar sample code and it works fine on there, but it doesn't work in the actual solution.
I wondered if someone could perhaps shed some light on the problem? Or perhaps knows of a reason that would prevent the appbar being shown when the page loads?
Many thanks
Chris
Copyright Notice:Content Author:「Chris Spittles」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/21020060/windows-8-1-winjs-appbar-wont-open-show-by-default