问题
I have built a wizard style user control that lets you add stackpanel based pages and flick between them.
I would like to add an application bar as part of the user control with next and previous buttons that enable/disable based on page displayed etc.
Application bar appears to be an attached property of PhoneApplicationPage. I have tried referencing Microsoft.Phone.Shell but get invalid type.
Any ideas how I can add it to my user control?
回答1:
Application bar is such a pain in the a**. This control is not a Silverlight one but a native one. Maybe you can be more lucky with this solution: http://blog.humann.info/post/2010/08/27/How-to-have-binding-on-the-ApplicationBar.aspx
回答2:
The ApplicationBar
is a service that is provided by the operating system, i.e. not part of the Framework, and can only be used at the page-level, not in your UserControl
. In addition, the ApplicationBar
does not support regular bindings as you've seen. As mentioned above there are a number of solutions that provide workarounds for this problem.
Alternatively, you could use the ApplicationBarButtonCommand
and ApplicationBarButtonNavigation
behaviors from the Silverlight Windows Phone Toolkit. It's a simple enough task to create your ApplicationBarMenuCommand
if you need one.
来源:https://stackoverflow.com/questions/4810743/how-to-add-an-application-bar-to-a-user-control-in-wp7