I'm trying to only show an App Bar when a user selects an item from a list view. I've got the app bar showing by using the appBar.show() and appBar.hide() methods but its not the only time it can be shown.
When I right click the page and don't have anything selected, the app bar still shows. How can I stop it showing?
I answer this in my free ebook, Programming Windows Store Apps with HTML, CSS, and JavaScript (2nd edition), in the app bar section (page 480):
Tip To prevent the app/nav bar from appearing, you can do one of two things. First, to prevent an app bar or nav bar from appearing at all (for any gesture), set the control’s disabled property to true. Second, if you want to prevent it for, say, a right-click on a particular element (such as a canvas), listen to the contextmenu (right click) event for that element and call eventArgs.preventDefault() within your handler.