Skip to content

Instantly share code, notes, and snippets.

@champierre
Created September 27, 2012 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save champierre/3792867 to your computer and use it in GitHub Desktop.
Save champierre/3792867 to your computer and use it in GitHub Desktop.
replace a button in appbar on windows 8 app
var appbar = document.getElementById("appbar");
var button = document.createElement("button");
button.setAttribute("data-win-control", "WinJS.UI.AppBarCommand");
// id, label, icon are dynamically set. button.setAttribute("type", "button");
button.setAttribute("data-win-options", "{id:'" + id + "', label:'" + label + "', icon:'" + icon + "'}");
WinJS.UI.process(button); appbar.appendChild(button);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment