Search code examples
javascriptwindows-runtimeappbar

How do I make an app bar not dismissable


I have an app bar in my Windows 8 application which should not be dismissable by the user during a certain time.

Setting its sticky property prevents it from being dismissed by clicking anywhere on the screen, however, you can still dismiss it by pressing windows-key + z, right clicking, or swiping on the bottom or top of the screen.

I have tried calling preventDefault() on the onbeforehide event but that didn't work. According to the documentation, the event is cancelable. Here's the code:

document.getElementById("placementAppbar").addEventListener(
"beforehide", 
function(e) {
    e.preventDefault();
});

What can I do to stop the appbar from being dismissed by the user?


Solution

  • See I was going through the link and

    I found the following quote

    Don't provide an alternate behavior for the Win+Z keypress combination in your app. Develop an app bar or similar context menu, and display it when the user presses the Windows key in conjunction with the Z key. Register for the KeyDown and AcceleratorKeyActivated events to determine when these two keys have been pressed.

    So i really think if you can work this the other way round like windows + z do some thing else. I mean override the functionality then it might work

    Here's the link

    App bar guidelines

    This is just a suggestion see if you can work your way round else I dont think there's an option.