summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.WP8/CustomContextMenu.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.WP8/CustomContextMenu.cs')
-rw-r--r--Xamarin.Forms.Platform.WP8/CustomContextMenu.cs27
1 files changed, 27 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.WP8/CustomContextMenu.cs b/Xamarin.Forms.Platform.WP8/CustomContextMenu.cs
new file mode 100644
index 00000000..4946b2b2
--- /dev/null
+++ b/Xamarin.Forms.Platform.WP8/CustomContextMenu.cs
@@ -0,0 +1,27 @@
+using System.Windows;
+using System.Windows.Controls;
+using Microsoft.Phone.Controls;
+using WMenuItem = Microsoft.Phone.Controls.MenuItem;
+using WApplication = System.Windows.Application;
+
+namespace Xamarin.Forms.Platform.WinPhone
+{
+ public sealed class CustomContextMenu : ContextMenu
+ {
+ protected override DependencyObject GetContainerForItemOverride()
+ {
+ var item = new WMenuItem();
+ item.SetBinding(HeaderedItemsControl.HeaderProperty, new System.Windows.Data.Binding("Text") { Converter = (System.Windows.Data.IValueConverter)WApplication.Current.Resources["LowerConverter"] });
+
+ item.Click += (sender, args) =>
+ {
+ IsOpen = false;
+
+ var menuItem = item.DataContext as MenuItem;
+ if (menuItem != null)
+ menuItem.Activate();
+ };
+ return item;
+ }
+ }
+} \ No newline at end of file