I would like the toggle the visibility of a ListBox by tapping on a button an ApplicationBar.
I created the ApplicationBar[s] using this guide. So their methods live in App.xaml.cs. The ListBox is in MainPage.xaml.
I don’t understand how I can access the ListBox from App.xaml.cs, and what I could find suggested that this is not the best practice.
I got the sense that I should somehow bind the ListBox’s visibility to the button.
Is that possible? If not, what should my approach be?
Place the applicationbar in your page and apply a event on your button. In this event, change the visibility of your listbox.
To create a ApplicationBar, this tutorial is better (the msot basic) :
http://msdn.microsoft.com/en-us/library/hh394040(v=vs.92).aspx
EDIT (comments) : You can bind a value from your VM to your Listbox (visibility) and change this value in App.xaml.cs 😉