Metro Nuggets
Bitesized tidbits for building Modern (Metro) apps.
PhoneFlipMenu Control for Windows Phone [UPDATED]
UPDATE: This control is now part of the coding4fun toolkit for Windows Phone. It’s usage is the same, but it’s been renamed to the AppBarPrompt. Any future updates will done to that, and not this version. Sample usage of the new prompt can be seen here.
The Windows Phone Mail app has, when you’re in an email, a respond button which when tapped, brings up three further options, as illustrated below:
On the left we have the icons on the application bar, tap the respond button (on the left) and you get the options as shown in the picture on the right.
There is, however, no way of doing that in your own apps, so I created this control that does it.
The Solution
Using this control is actually very straight forward, in your page (or ViewModel), add the required using statement:
using ScottIsAFool.WindowsPhone.Tools;
Then in your application bar button’s click event (again, or a ViewModel command) just put something like this:
private void ApplicationBarIconButton_Click(object sender, EventArgs e) { new PhoneFlipMenu(new PhoneFlipMenuAction("reply", () => { MessageBox.Show("Hello"); }), new PhoneFlipMenuAction("reply all", () => { }), new PhoneFlipMenuAction("forward", () => { })).Show(); }
Each entry to be added comes in the form of a PhoneFlipMenuAction and that requires a text string and an Action, as can be seen in the above code.
Back Button
For marketplace certification, any dialog box or context menu that is displayed to the user should be able to be cleared by pressing the back button on the phone. PhoneFlipMenu supports this 100%.
Themes
What about themes I hear you say. PhoneFlipMenu is fully compatible with whatever theme you have, even if it’s custom. If your Applicationbar is Brown, so will PhoneFlipMenu. Using the defaults and on a Light theme? Not a problem, PhoneFlipMenu will look exactly the same as the Mail App.
Download
So where can you download this? Well, you can either download it from codeplex (yup, it’s open source), or the much better way of using nuget:
Source
I mentioned it’s open source right? Yeah, so go take a gander if you like, it’s at http://phoneflipmenu.codeplex.com/
SL
Pingback: PhoneFlipMenu Control for Windows Phone
Nice, thanks alot!
Very cool, but it needs to handle the ad control better as it hides behind the ad control when shown. Of course you can work around that, but it would be better if the control handled that automatically.
@jason thanks for the feedback on that, will take a look and see what I can do.
Pingback: Launching a Context Menu From Code | Metro Nuggets