Enable Databindable ApplicationBar (buttons and menuitems)
Right now it's not easy to enable DataBinding on the ApplicationBar buttons and menuitems.
- When created in Xaml there's no way to get a reference to them, should be different.
- Should be easily bound to a command, same as for icon and text should be bindable.
as of now, Application bar cannot use bindings, and doesn't support commanding, we'd really need a better integration of the ApplicationBar with the rest of the application.
Thank you for the suggestion and commentary. While we are not adding this capability in the 8.0 release, there are currently a variety of community projects out there (see the comments for some suggestions). Please know that this is also definitely on the consideration list for future Windows Phone releases.
Keep those suggestions and votes coming!
Also be able to databind to events from controls, such as a LongListSelector's SelectionChanged event would be nice.
Basically, ApplicationBar, ApplicationBarIconButton and ApplicationBarMenuItem only have to inherit from FrameworkElement and 'Text' and other properties be changed to 'DependencyProperty's.
It would be very easy to write a BindableApplicationButton, if PhoneApplicationPage allowed an Application bar not only being ApplicationBar, but rather every type inherited of IApplicationBar.
Daniel Vaughan commented
Calcium SDK has a pretty useful bindable Application Bar wrapper. I use that for all my apps. http://calciumsdk.com
you can always write your own application bar
Or you can write ApplicationBar wrapper, which will support binding and so on...
Sudarsan Srinivasan commented
A must thing for a dev who is used to writing MVVM pattern based code.
Pedro Lamas commented
Please check my Cimbalino Windows Phone Toolkit for a bindable ApplicationBar behavior! ;)
Valentin Stoychev commented
This is a also a BIG problem when you want to localize the buttons.
Lack of Commanding for ApplicationBar is a major annoyance for me, resulting in some less than ideal workarounds for updating Enabled status of these controls.
Richard Szalay commented
@Peter - Mark is likely referring to MVVM. As ApplicationBar buttons/icons are not DependencyObjects, they cannot be bound to. This requires adding code to the code behind, which can't be tested.
Peter Wone commented
No way to get a reference? Bollocks. Declare a page member.
Then set it in OnNavigatedTo.
appbar_buttonAddToFavourites = ApplicationBar.Buttons as ApplicationBarIconButton;
The buttons are indexed 0..3 in the order they are declared in XAML.
this suggestion was already mentioned. please remove it and vote for the other.
Also, I would like to have animations for the applicationbar as in the native e-mail client