I have a Windows Phone 7 application built in Silverlight. This application makes use of the application bar. If the has purchased the application, I want to hide one of the buttons in the application bar. However, I’ve noticed that the ApplicationIconButton class does not expose a “Visibility” property. At the same time, I did not see a way to dynamically populate the application bar at runtime.
Can anybody provide some insight into this? Is this possible? If so, how?
Thanks!
Application bar buttons work in an index-based way rather than object-based like you would expect. Therefore, you need to specify a button index whenever you want to perform a specific action on it (e.g. disable).
For example:
This being said, you can create new ApplicationBarIconButton instances and pass them to ApplicationBar:
When removing buttons, you can simply use RemoveAt, given that you know the index of the button to remove: