summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.WP8/Platform.cs
diff options
context:
space:
mode:
authorSamantha Houts <samantha@teamredwall.com>2016-06-17 03:10:18 -0700
committerRui Marinho <me@ruimarinho.net>2016-06-17 11:10:18 +0100
commit925fc0aa588a060eb23fa16c1d225dd030012c23 (patch)
tree83676c25c29d97d9250516b217020ba85425796d /Xamarin.Forms.Platform.WP8/Platform.cs
parentd44396a4534b1e2bc81143c809e4adaee656ab15 (diff)
downloadxamarin-forms-925fc0aa588a060eb23fa16c1d225dd030012c23.tar.gz
xamarin-forms-925fc0aa588a060eb23fa16c1d225dd030012c23.tar.bz2
xamarin-forms-925fc0aa588a060eb23fa16c1d225dd030012c23.zip
Prep Cell & friends for removal of InternalsVisibleTo (#142)
* Prep Cell & friends for removal of InternalsVisibleTo Includes: - Cell - EntryCell - ListView - MenuItem - TableView - ViewCell - Toolbar Moved extensions to Internal & removed TPH * Update docs * [Controls] Ignore Issue2411 on iOS <9 * [Controls] Formatting for Issue2411
Diffstat (limited to 'Xamarin.Forms.Platform.WP8/Platform.cs')
-rw-r--r--Xamarin.Forms.Platform.WP8/Platform.cs16
1 files changed, 10 insertions, 6 deletions
diff --git a/Xamarin.Forms.Platform.WP8/Platform.cs b/Xamarin.Forms.Platform.WP8/Platform.cs
index 00623b4d..be71df09 100644
--- a/Xamarin.Forms.Platform.WP8/Platform.cs
+++ b/Xamarin.Forms.Platform.WP8/Platform.cs
@@ -7,6 +7,7 @@ using System.Windows;
using System.Windows.Controls;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
+using Xamarin.Forms.Internals;
namespace Xamarin.Forms.Platform.WinPhone
{
@@ -536,6 +537,7 @@ namespace Xamarin.Forms.Platform.WinPhone
var buttonsToAdd = new List<TaggedAppBarButton>();
foreach (ToolbarItem item in items.Where(i => i.Order != ToolbarItemOrder.Secondary))
{
+ IMenuItemController controller = item;
if (_page.ApplicationBar.Buttons.OfType<TaggedAppBarButton>().Any(b => b.Tag == item))
continue;
@@ -543,10 +545,10 @@ namespace Xamarin.Forms.Platform.WinPhone
{
IconUri = new Uri(item.Icon ?? "ApplicationIcon.jpg", UriKind.Relative),
Text = !string.IsNullOrWhiteSpace(item.Text) ? item.Text : (string)item.Icon ?? "ApplicationIcon.jpg",
- IsEnabled = item.IsEnabled,
+ IsEnabled = controller.IsEnabled,
Tag = item
};
- button.Click += (sender, args) => item.Activate();
+ button.Click += (sender, args) => controller.Activate();
buttonsToAdd.Add(button);
}
@@ -557,7 +559,7 @@ namespace Xamarin.Forms.Platform.WinPhone
continue;
var button = new TaggedAppBarMenuItem { Text = !string.IsNullOrWhiteSpace(item.Text) ? item.Text : (string)item.Icon ?? "MenuItem", IsEnabled = true, Tag = item };
- button.Click += (sender, args) => item.Activate();
+ button.Click += (sender, args) => ((IMenuItemController)item).Activate();
menuItemsToAdd.Add(button);
}
@@ -565,7 +567,7 @@ namespace Xamarin.Forms.Platform.WinPhone
TaggedAppBarMenuItem[] deadMenuItems = _page.ApplicationBar.MenuItems.OfType<TaggedAppBarMenuItem>().Where(b => b.Tag is ToolbarItem && !items.Contains(b.Tag)).ToArray();
- // we must remove the dead buttons before adding the new ones so we dont accidentally go over the limit during the tranistion
+ // we must remove the dead buttons before adding the new ones so we don't accidentally go over the limit during the transition
foreach (TaggedAppBarButton deadButton in deadButtons)
{
deadButton.Dispose();
@@ -623,8 +625,10 @@ namespace Xamarin.Forms.Platform.WinPhone
if (item == null)
return;
- if (e.PropertyName == MenuItem.IsEnabledProperty.PropertyName)
- IsEnabled = item.IsEnabled;
+ IMenuItemController controller = item;
+
+ if (e.PropertyName == controller.IsEnabledPropertyName)
+ IsEnabled = controller.IsEnabled;
else if (e.PropertyName == MenuItem.TextProperty.PropertyName)
Text = !string.IsNullOrWhiteSpace(item.Text) ? item.Text : (string)item.Icon ?? "ApplicationIcon.jpg";
else if (e.PropertyName == MenuItem.IconProperty.PropertyName)