Windows Phone 7 App bar, global events
windows-phone-7
Solution
If you want to create and reuse an ApplicationBar, you can create as a resource in the App.xaml and create the EventHandler for the Click events of the buttons on the App.xaml.cs file and on the pages just reference that resource.
Other options in to create the ApplicationBar based only on code and in that case you can have a global function on can call on any page to create the bar.
Personally, I'd just go ahead with the code-only option!
Problem
I'm playing around with windows phone and looking at writing my first window phone 7 application. I've coded in windows 6.5 and code in c# for my daily job. So far it's all going well. Fairly simple and for most points where i have got stuck there has been a tutorial for it. My problem is I've implemented the Application Bar, and am using this on a number of views. In order to keep my code DRY i'm reluctant to create the events on each page. This seams a waste of developer time. Is there a way around this? Should i create a base class and inherit from it? Are the Xaml templates? Should i just suck it up and duplicate the code? Thanks for any help.