Windows Phone 7 Hiding the Application Bar

北城余情 提交于 2020-01-22 17:42:48

问题


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?


回答1:


You can access this as a static member on ApplicationBar. i.e.

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




回答2:


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




回答3:


To do it in code behind if you have not referenced it other than in XAML:

(ApplicationBar as ApplicationBar).IsVisible = true;



回答4:


ApplicationBar.IsVisible = false;



来源:https://stackoverflow.com/questions/4116311/windows-phone-7-hiding-the-application-bar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!