简体   繁体   中英

Windows Phone 7 Hiding the Application Bar

I would like to be able to press a button to disable the menu bar in my application. If you go

menubar.IsVisible = false;

it throws a null reference exception. The menu bar is declared in XAML.

Anyone know if its possible to hide it on the fly like this?

You can access this as a static member on ApplicationBar. ie

ApplicationBar.IsVisible = true/false;

Some background here on why ApplicationBar doesn't play like normal silverlight elements.

Why are the ApplicationBar objects not FrameworkElements? - Peter Torr's Blog

Nevermind, I found it. You can't call the name you've given it, have to use applicationbar.isivisble = false

如果您没有在XAML中引用它,请在代码后面执行此操作:

(ApplicationBar as ApplicationBar).IsVisible = true;

ApplicationBar.IsVisible = false;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM