summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorE.Z. Hart <hartez@users.noreply.github.com>2016-06-16 15:45:09 (GMT)
committerRui Marinho <me@ruimarinho.net>2016-06-16 15:45:09 (GMT)
commitd5be2f0144ca810fdfbf59808d526c26fe86017e (patch)
tree3ad7e4465307cd6d633184e05d85eb3a4df59e01
parent04f7bd296ee67af9189ecd7fdfbd2808ca16ce9a (diff)
downloadxamarin-forms-d5be2f0144ca810fdfbf59808d526c26fe86017e.zip
xamarin-forms-d5be2f0144ca810fdfbf59808d526c26fe86017e.tar.gz
xamarin-forms-d5be2f0144ca810fdfbf59808d526c26fe86017e.tar.bz2
Prep Page for removal of InternalsVisibleTo (#150)
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/NavigationStackTests.cs2
-rw-r--r--Xamarin.Forms.Core.UnitTests/ContentViewUnitTest.cs10
-rw-r--r--Xamarin.Forms.Core.UnitTests/ControlTemplateTests.cs20
-rw-r--r--Xamarin.Forms.Core.UnitTests/ElementTests.cs2
-rw-r--r--Xamarin.Forms.Core.UnitTests/GridTests.cs2
-rw-r--r--Xamarin.Forms.Core.UnitTests/GroupViewUnitTests.cs28
-rw-r--r--Xamarin.Forms.Core.UnitTests/MultiPageTests.cs4
-rw-r--r--Xamarin.Forms.Core.UnitTests/NavigationUnitTest.cs4
-rw-r--r--Xamarin.Forms.Core.UnitTests/NotifiedPropertiesTests.cs2
-rw-r--r--Xamarin.Forms.Core.UnitTests/PageTests.cs31
-rw-r--r--Xamarin.Forms.Core/AbsoluteLayout.cs4
-rw-r--r--Xamarin.Forms.Core/Application.cs2
-rw-r--r--Xamarin.Forms.Core/Cells/ViewCell.cs2
-rw-r--r--Xamarin.Forms.Core/ContentPresenter.cs4
-rw-r--r--Xamarin.Forms.Core/Element.cs15
-rw-r--r--Xamarin.Forms.Core/IElementController.cs3
-rw-r--r--Xamarin.Forms.Core/IPageController.cs17
-rw-r--r--Xamarin.Forms.Core/Layout.cs14
-rw-r--r--Xamarin.Forms.Core/MasterDetailPage.cs10
-rw-r--r--Xamarin.Forms.Core/MultiPage.cs5
-rw-r--r--Xamarin.Forms.Core/NavigationPage.cs39
-rw-r--r--Xamarin.Forms.Core/Page.cs61
-rw-r--r--Xamarin.Forms.Core/StackLayout.cs26
-rw-r--r--Xamarin.Forms.Core/TemplateUtilities.cs2
-rw-r--r--Xamarin.Forms.Core/TemplatedPage.cs2
-rw-r--r--Xamarin.Forms.Core/TemplatedView.cs4
-rw-r--r--Xamarin.Forms.Core/VisualElement.cs4
-rw-r--r--Xamarin.Forms.Core/Xamarin.Forms.Core.csproj1
-rw-r--r--Xamarin.Forms.Platform.Android/AppCompat/CarouselPageRenderer.cs14
-rw-r--r--Xamarin.Forms.Platform.Android/AppCompat/FragmentContainer.cs14
-rw-r--r--Xamarin.Forms.Platform.Android/AppCompat/FrameRenderer.cs2
-rw-r--r--Xamarin.Forms.Platform.Android/AppCompat/MasterDetailPageRenderer.cs16
-rw-r--r--Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs18
-rw-r--r--Xamarin.Forms.Platform.Android/AppCompat/Platform.cs12
-rw-r--r--Xamarin.Forms.Platform.Android/AppCompat/TabbedPageRenderer.cs28
-rw-r--r--Xamarin.Forms.Platform.Android/Platform.cs14
-rw-r--r--Xamarin.Forms.Platform.Android/RendererPool.cs4
-rw-r--r--Xamarin.Forms.Platform.Android/Renderers/CarouselPageAdapter.cs6
-rw-r--r--Xamarin.Forms.Platform.Android/Renderers/CarouselPageRenderer.cs8
-rw-r--r--Xamarin.Forms.Platform.Android/Renderers/ImageRenderer.cs5
-rw-r--r--Xamarin.Forms.Platform.Android/Renderers/MasterDetailRenderer.cs22
-rw-r--r--Xamarin.Forms.Platform.Android/Renderers/NavigationRenderer.cs23
-rw-r--r--Xamarin.Forms.Platform.Android/Renderers/PageRenderer.cs8
-rw-r--r--Xamarin.Forms.Platform.Android/Renderers/PickerRenderer.cs12
-rw-r--r--Xamarin.Forms.Platform.Android/Renderers/TabbedRenderer.cs6
-rw-r--r--Xamarin.Forms.Platform.Android/Renderers/TimePickerRenderer.cs10
-rw-r--r--Xamarin.Forms.Platform.Android/VisualElementPackager.cs15
-rw-r--r--Xamarin.Forms.Platform.Android/VisualElementRenderer.cs2
-rw-r--r--Xamarin.Forms.Platform.UAP/MasterDetailPageRenderer.cs9
-rw-r--r--Xamarin.Forms.Platform.UAP/TabbedPageRenderer.cs24
-rw-r--r--Xamarin.Forms.Platform.WP8/CarouselPageRenderer.cs6
-rw-r--r--Xamarin.Forms.Platform.WP8/ImageRenderer.cs2
-rw-r--r--Xamarin.Forms.Platform.WP8/MasterDetailRenderer.cs6
-rw-r--r--Xamarin.Forms.Platform.WP8/NavigationPageRenderer.cs26
-rw-r--r--Xamarin.Forms.Platform.WP8/PageRenderer.cs4
-rw-r--r--Xamarin.Forms.Platform.WP8/PickerRenderer.cs8
-rw-r--r--Xamarin.Forms.Platform.WP8/Platform.cs2
-rw-r--r--Xamarin.Forms.Platform.WP8/StepperRenderer.cs6
-rw-r--r--Xamarin.Forms.Platform.WP8/SwitchRenderer.cs6
-rw-r--r--Xamarin.Forms.Platform.WP8/TabbedPageRenderer.cs6
-rw-r--r--Xamarin.Forms.Platform.WP8/VisualElementPackager.cs8
-rw-r--r--Xamarin.Forms.Platform.WP8/VisualElementRenderer.cs14
-rw-r--r--Xamarin.Forms.Platform.WinRT.Phone/TabbedPageRenderer.cs6
-rw-r--r--Xamarin.Forms.Platform.WinRT.Tablet/TabbedPageRenderer.cs7
-rw-r--r--Xamarin.Forms.Platform.WinRT/CarouselPageRenderer.cs16
-rw-r--r--Xamarin.Forms.Platform.WinRT/MasterDetailPageRenderer.cs12
-rw-r--r--Xamarin.Forms.Platform.WinRT/NavigationPageRenderer.cs21
-rw-r--r--Xamarin.Forms.Platform.WinRT/PageRenderer.cs17
-rw-r--r--Xamarin.Forms.Platform.WinRT/ViewToRendererConverter.cs2
-rw-r--r--Xamarin.Forms.Platform.WinRT/VisualElementPackager.cs10
-rw-r--r--Xamarin.Forms.Platform.WinRT/VisualElementRenderer.cs10
-rw-r--r--Xamarin.Forms.Platform.iOS/RendererPool.cs12
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs22
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/DatePickerRenderer.cs9
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs6
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs8
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs2
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs12
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs8
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs8
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/PickerRenderer.cs8
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs12
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs20
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs13
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/TimePickerRenderer.cs8
-rw-r--r--Xamarin.Forms.Platform.iOS/VisualElementPackager.cs18
-rw-r--r--docs/Xamarin.Forms.Core/Xamarin.Forms/Element.xml16
-rw-r--r--docs/Xamarin.Forms.Core/Xamarin.Forms/IElementController.xml16
-rw-r--r--docs/Xamarin.Forms.Core/Xamarin.Forms/IPageController.xml95
-rw-r--r--docs/Xamarin.Forms.Core/Xamarin.Forms/Page.xml132
90 files changed, 793 insertions, 419 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/NavigationStackTests.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/NavigationStackTests.cs
index 8cbaaaf..19cd743 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/NavigationStackTests.cs
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/NavigationStackTests.cs
@@ -57,7 +57,7 @@ namespace Xamarin.Forms.Controls.TestCasesPages
}
if (navPage != null) {
- navPage.Navigation.RemovePage ((Page) navPage.InternalChildren[navPage.InternalChildren.Count - 2]);
+ navPage.Navigation.RemovePage ((Page)((IPageController)navPage).InternalChildren[((IPageController)navPage).InternalChildren.Count - 2]);
}
};
diff --git a/Xamarin.Forms.Core.UnitTests/ContentViewUnitTest.cs b/Xamarin.Forms.Core.UnitTests/ContentViewUnitTest.cs
index 9d7a12e..73bb531 100644
--- a/Xamarin.Forms.Core.UnitTests/ContentViewUnitTest.cs
+++ b/Xamarin.Forms.Core.UnitTests/ContentViewUnitTest.cs
@@ -280,7 +280,7 @@ namespace Xamarin.Forms.Core.UnitTests
contentView.Content = child;
contentView.Platform = platform;
- Assert.AreEqual (child, contentView.LogicalChildren[0]);
+ Assert.AreEqual (child, ((IElementController)contentView).LogicalChildren[0]);
}
class SimpleTemplate : StackLayout
@@ -303,7 +303,7 @@ namespace Xamarin.Forms.Core.UnitTests
contentView.ControlTemplate = new ControlTemplate (typeof (SimpleTemplate));
contentView.Platform = platform;
- Assert.That (contentView.LogicalChildren[0], Is.TypeOf<SimpleTemplate> ());
+ Assert.That (((IElementController)contentView).LogicalChildren[0], Is.TypeOf<SimpleTemplate> ());
}
[Test]
@@ -318,7 +318,7 @@ namespace Xamarin.Forms.Core.UnitTests
contentView.Content = child;
contentView.Platform = platform;
- Assume.That (contentView.LogicalChildren[0], Is.TypeOf<SimpleTemplate> ());
+ Assume.That (((IElementController)contentView).LogicalChildren[0], Is.TypeOf<SimpleTemplate> ());
Assert.That (contentView.Descendants (), Contains.Item (child));
}
@@ -337,8 +337,8 @@ namespace Xamarin.Forms.Core.UnitTests
var bc = "Test";
contentView.BindingContext = bc;
- Assert.AreNotEqual (bc, contentView.LogicalChildren[0].BindingContext);
- Assert.IsNull (contentView.LogicalChildren[0].BindingContext);
+ Assert.AreNotEqual (bc, ((IElementController)contentView).LogicalChildren[0].BindingContext);
+ Assert.IsNull (((IElementController)contentView).LogicalChildren[0].BindingContext);
}
[Test]
diff --git a/Xamarin.Forms.Core.UnitTests/ControlTemplateTests.cs b/Xamarin.Forms.Core.UnitTests/ControlTemplateTests.cs
index ffced2d..f0d22d1 100644
--- a/Xamarin.Forms.Core.UnitTests/ControlTemplateTests.cs
+++ b/Xamarin.Forms.Core.UnitTests/ControlTemplateTests.cs
@@ -70,7 +70,11 @@ namespace Xamarin.Forms.Core.UnitTests
var label = new Label ();
testView.Content = label;
- var originalPresenter = (ContentPresenter)testView.LogicalChildren[0].LogicalChildren[0];
+
+ var child1 = ((IElementController)testView).LogicalChildren[0];
+ var child2 = ((IElementController)child1).LogicalChildren[0];
+
+ var originalPresenter = (ContentPresenter)child2;
Assert.AreEqual (label, originalPresenter.Content);
@@ -83,7 +87,11 @@ namespace Xamarin.Forms.Core.UnitTests
public void NestedTemplateBindings ()
{
var testView = new TestView ();
- var label = (Label)testView.LogicalChildren[0].LogicalChildren[0];
+
+ var child1 = ((IElementController)testView).LogicalChildren[0];
+ var child2 = ((IElementController)child1).LogicalChildren[0];
+
+ var label = (Label)child2;
testView.Platform = new UnitPlatform ();
Assert.IsNull (label.Text);
@@ -101,7 +109,11 @@ namespace Xamarin.Forms.Core.UnitTests
parentView.Content = childView;
childView.Content = new Button ();
- var childPresenter = (ContentPresenter)childView.LogicalChildren[0].LogicalChildren[1];
+
+ var child1 = ((IElementController)childView).LogicalChildren[0];
+ var child2 = ((IElementController)child1).LogicalChildren[1];
+
+ var childPresenter = (ContentPresenter)child2;
parentView.ControlTemplate = new ControlTemplate (typeof (ContentControl));
Assert.IsNotNull (childPresenter.Content);
@@ -171,7 +183,7 @@ namespace Xamarin.Forms.Core.UnitTests
page.ControlTemplate = new ControlTemplate (typeof (TestContent));
page.SetBinding (TestPage.NameProperty, "Name");
- var entry = ((ContentView)page.LogicalChildren[0]).Content as Entry;
+ var entry = ((ContentView)((IElementController)page).LogicalChildren[0]).Content as Entry;
((IElementController)entry).SetValueFromRenderer (Entry.TextProperty, "Bar");
viewModel.Name = "Raz";
diff --git a/Xamarin.Forms.Core.UnitTests/ElementTests.cs b/Xamarin.Forms.Core.UnitTests/ElementTests.cs
index 6bffe33..8ac782e 100644
--- a/Xamarin.Forms.Core.UnitTests/ElementTests.cs
+++ b/Xamarin.Forms.Core.UnitTests/ElementTests.cs
@@ -31,7 +31,7 @@ namespace Xamarin.Forms.Core.UnitTests
get { return internalChildren; }
}
- internal override ReadOnlyCollection<Element> LogicalChildren
+ internal override ReadOnlyCollection<Element> LogicalChildrenInternal
{
get { return new ReadOnlyCollection<Element> (internalChildren); }
}
diff --git a/Xamarin.Forms.Core.UnitTests/GridTests.cs b/Xamarin.Forms.Core.UnitTests/GridTests.cs
index 359d2b5..fa92b56 100644
--- a/Xamarin.Forms.Core.UnitTests/GridTests.cs
+++ b/Xamarin.Forms.Core.UnitTests/GridTests.cs
@@ -771,7 +771,7 @@ namespace Xamarin.Forms.Core.UnitTests
};
layout.Children.Remove (labela0);
- Assert.False (layout.LogicalChildren.Contains (labela0));
+ Assert.False (((IElementController)layout).LogicalChildren.Contains (labela0));
}
[Test]
diff --git a/Xamarin.Forms.Core.UnitTests/GroupViewUnitTests.cs b/Xamarin.Forms.Core.UnitTests/GroupViewUnitTests.cs
index fe823b1..215b135 100644
--- a/Xamarin.Forms.Core.UnitTests/GroupViewUnitTests.cs
+++ b/Xamarin.Forms.Core.UnitTests/GroupViewUnitTests.cs
@@ -10,7 +10,7 @@ namespace Xamarin.Forms.Core.UnitTests
{
protected override void LayoutChildren (double x, double y, double width, double height)
{
- foreach (var child in LogicalChildren.Cast<View>()) {
+ foreach (var child in ((IElementController)this).LogicalChildren.Cast<View>()) {
var result = new Rectangle (x, y, 0, 0);
var request = child.GetSizeRequest (double.PositiveInfinity, double.PositiveInfinity);
result.Width = request.Request.Width;
@@ -42,11 +42,11 @@ namespace Xamarin.Forms.Core.UnitTests
view.RaiseChild (child1);
- Assert.AreEqual (child1, view.LogicalChildren [2]);
+ Assert.AreEqual (child1, ((IElementController)view).LogicalChildren [2]);
Assert.True (reordered);
view.RaiseChild (child2);
- Assert.AreEqual (child2, view.LogicalChildren [2]);
+ Assert.AreEqual (child2, ((IElementController)view).LogicalChildren [2]);
}
[Test]
@@ -87,11 +87,11 @@ namespace Xamarin.Forms.Core.UnitTests
view.LowerChild (child3);
- Assert.AreEqual (child3, view.LogicalChildren [0]);
+ Assert.AreEqual (child3, ((IElementController)view).LogicalChildren [0]);
Assert.True (reordered);
view.LowerChild (child2);
- Assert.AreEqual (child2, view.LogicalChildren [0]);
+ Assert.AreEqual (child2, ((IElementController)view).LogicalChildren [0]);
}
[Test]
@@ -126,7 +126,7 @@ namespace Xamarin.Forms.Core.UnitTests
view.Children.Add (child1);
Assert.True (added);
- Assert.AreEqual (child1, view.LogicalChildren [0]);
+ Assert.AreEqual (child1, ((IElementController)view).LogicalChildren [0]);
}
[Test]
@@ -142,7 +142,7 @@ namespace Xamarin.Forms.Core.UnitTests
view.Children.Add (child1);
Assert.False (added);
- Assert.AreEqual (child1, view.LogicalChildren [0]);
+ Assert.AreEqual (child1, ((IElementController)view).LogicalChildren [0]);
}
[Test]
@@ -159,7 +159,7 @@ namespace Xamarin.Forms.Core.UnitTests
view.Children.Remove (child1);
Assert.True (removed);
- Assert.False (view.LogicalChildren.Any ());
+ Assert.False (((IElementController)view).LogicalChildren.Any ());
}
[Test]
@@ -177,7 +177,7 @@ namespace Xamarin.Forms.Core.UnitTests
view.Children.Add (child);
int i = 0;
- foreach (var child in view.LogicalChildren) {
+ foreach (var child in ((IElementController)view).LogicalChildren) {
Assert.AreEqual (children[i], child);
i++;
}
@@ -198,7 +198,7 @@ namespace Xamarin.Forms.Core.UnitTests
view.Children.Add (child);
int i = 0;
- var enumerator = (view.LogicalChildren as IEnumerable).GetEnumerator ();
+ var enumerator = (((IElementController)view).LogicalChildren as IEnumerable).GetEnumerator ();
while (enumerator.MoveNext ()) {
Assert.AreEqual (children [i], enumerator.Current as View);
i++;
@@ -216,10 +216,10 @@ namespace Xamarin.Forms.Core.UnitTests
}
};
- Assert.AreEqual (2, group.LogicalChildren.Count);
- Assert.IsTrue (group.LogicalChildren.Contains (view1));
- Assert.IsTrue (group.LogicalChildren.Contains (view2));
- Assert.AreEqual (view1, group.LogicalChildren[0]);
+ Assert.AreEqual (2, ((IElementController)group).LogicalChildren.Count);
+ Assert.IsTrue (((IElementController)group).LogicalChildren.Contains (view1));
+ Assert.IsTrue (((IElementController)group).LogicalChildren.Contains (view2));
+ Assert.AreEqual (view1, ((IElementController)group).LogicalChildren[0]);
}
[Test]
diff --git a/Xamarin.Forms.Core.UnitTests/MultiPageTests.cs b/Xamarin.Forms.Core.UnitTests/MultiPageTests.cs
index 3d9faad..7293914 100644
--- a/Xamarin.Forms.Core.UnitTests/MultiPageTests.cs
+++ b/Xamarin.Forms.Core.UnitTests/MultiPageTests.cs
@@ -47,7 +47,7 @@ namespace Xamarin.Forms.Core.UnitTests
container.Children.Add (CreateContainedPage());
Assert.AreEqual (2, childCount);
- Assert.AreEqual (2, page.LogicalChildren.Count);
+ Assert.AreEqual (2, ((IElementController)page).LogicalChildren.Count);
Assert.AreEqual (2, pagesAdded);
}
@@ -71,7 +71,7 @@ namespace Xamarin.Forms.Core.UnitTests
Assert.AreEqual (2, removeCount);
Assert.AreEqual (2, childCount);
- Assert.AreEqual (2, page.LogicalChildren.Count);
+ Assert.AreEqual (2, ((IElementController)page).LogicalChildren.Count);
}
[Test]
diff --git a/Xamarin.Forms.Core.UnitTests/NavigationUnitTest.cs b/Xamarin.Forms.Core.UnitTests/NavigationUnitTest.cs
index a6abee5..f43e701 100644
--- a/Xamarin.Forms.Core.UnitTests/NavigationUnitTest.cs
+++ b/Xamarin.Forms.Core.UnitTests/NavigationUnitTest.cs
@@ -216,8 +216,10 @@ namespace Xamarin.Forms.Core.UnitTests
var root = new ContentPage ();
var nav = new NavigationPage (root);
- Assert.AreEqual (root, nav.LogicalChildren[0]);
+
Assert.AreEqual (1, ((INavigationPageController)nav).StackDepth);
+ Assert.AreEqual (root, ((IElementController)nav).LogicalChildren[0]);
+
}
[Test]
diff --git a/Xamarin.Forms.Core.UnitTests/NotifiedPropertiesTests.cs b/Xamarin.Forms.Core.UnitTests/NotifiedPropertiesTests.cs
index ede7e0d..fcc9d97 100644
--- a/Xamarin.Forms.Core.UnitTests/NotifiedPropertiesTests.cs
+++ b/Xamarin.Forms.Core.UnitTests/NotifiedPropertiesTests.cs
@@ -119,7 +119,7 @@ namespace Xamarin.Forms.Core.UnitTests
new PropertyTestCase<Page, Color> ("BackgroundColor", v => v.BackgroundColor, (v, o) => v.BackgroundColor = o, () => default(Color), new Color (0, 1, 0)),
new PropertyTestCase<Page, string> ("Title", v => v.Title, (v, o) => v.Title = o, () => null, "Foo"),
new PropertyTestCase<Page, bool> ("IsBusy", v => v.IsBusy, (v, o) => v.IsBusy = o, () => false, true),
- new PropertyTestCase<Page, bool> ("IgnoresContainerArea", v => v.IgnoresContainerArea, (v, o) => v.IgnoresContainerArea = o, () => false, true),
+ new PropertyTestCase<Page, bool> ("IgnoresContainerArea", v => ((IPageController)v).IgnoresContainerArea, (v, o) => ((IPageController)v).IgnoresContainerArea = o, () => false, true),
new PropertyTestCase<Page, Thickness> ("Padding", v => v.Padding, (v, o) => v.Padding = o, () => default(Thickness), new Thickness (12)),
new PropertyTestCase<Picker, string> ("Title", v=>v.Title, (v, o) =>v.Title = o, () => null, "FooBar"),
new PropertyTestCase<Picker, int> ("SelectedIndex", v=>v.SelectedIndex, (v, o) =>v.SelectedIndex = o, () => -1, 2, ()=>new Picker{Items= {"Foo", "Bar", "Baz", "Qux"}}),
diff --git a/Xamarin.Forms.Core.UnitTests/PageTests.cs b/Xamarin.Forms.Core.UnitTests/PageTests.cs
index f44d004..74b56d8 100644
--- a/Xamarin.Forms.Core.UnitTests/PageTests.cs
+++ b/Xamarin.Forms.Core.UnitTests/PageTests.cs
@@ -22,8 +22,8 @@ namespace Xamarin.Forms.Core.UnitTests
var child = new Label ();
Page root = new ContentPage {Content = child};
- Assert.AreEqual (root.LogicalChildren.Count, 1);
- Assert.AreSame (root.LogicalChildren.First (), child);
+ Assert.AreEqual (((IElementController)root).LogicalChildren.Count, 1);
+ Assert.AreSame (((IElementController)root).LogicalChildren.First (), child);
}
[Test]
@@ -257,8 +257,7 @@ namespace Xamarin.Forms.Core.UnitTests
page.Layout (new Rectangle (0, 0, 800, 800));
Assert.AreEqual (new Rectangle (0, 0, 800, 800), child.Bounds);
-
- page.ContainerArea = new Rectangle (10, 10, 30, 30);
+ ((IPageController)page).ContainerArea = new Rectangle (10, 10, 30, 30);
Assert.AreEqual (new Rectangle (10, 10, 30, 30), child.Bounds);
@@ -315,7 +314,7 @@ namespace Xamarin.Forms.Core.UnitTests
Assert.That (sent, Is.False, "Busy message sent while not visible");
- page.SendAppearing();
+ ((IPageController)page).SendAppearing();
Assert.That (sent, Is.True, "Busy message not sent when visible");
}
@@ -324,7 +323,7 @@ namespace Xamarin.Forms.Core.UnitTests
public void BusySentWhenBusyPageDisappears()
{
var page = new ContentPage { IsBusy = true };
- page.SendAppearing();
+ ((IPageController)page).SendAppearing();
var sent = false;
MessagingCenter.Subscribe<Page, bool> (this, Page.BusySetSignalName, (p, b) => {
@@ -332,7 +331,7 @@ namespace Xamarin.Forms.Core.UnitTests
sent = true;
});
- page.SendDisappearing();
+ ((IPageController)page).SendDisappearing();
Assert.That (sent, Is.True, "Busy message not sent when visible");
}
@@ -344,7 +343,7 @@ namespace Xamarin.Forms.Core.UnitTests
MessagingCenter.Subscribe<Page, bool> (this, Page.BusySetSignalName, (p, b) => sent = true);
var page = new ContentPage();
- page.SendAppearing();
+ ((IPageController)page).SendAppearing();
Assert.That (sent, Is.False, "Busy message sent appearing while not busy");
@@ -408,7 +407,7 @@ namespace Xamarin.Forms.Core.UnitTests
bool sent = false;
page.Appearing += (sender, args) => sent = true;
- page.SendAppearing ();
+ ((IPageController)page).SendAppearing ();
Assert.True (sent);
}
@@ -418,12 +417,12 @@ namespace Xamarin.Forms.Core.UnitTests
{
var page = new ContentPage ();
- page.SendAppearing ();
+ ((IPageController)page).SendAppearing ();
bool sent = false;
page.Disappearing += (sender, args) => sent = true;
- page.SendDisappearing ();
+ ((IPageController)page).SendDisappearing ();
Assert.True (sent);
}
@@ -436,8 +435,8 @@ namespace Xamarin.Forms.Core.UnitTests
int countAppearing = 0;
page.Appearing += (sender, args) => countAppearing++;
- page.SendAppearing ();
- page.SendAppearing ();
+ ((IPageController)page).SendAppearing ();
+ ((IPageController)page).SendAppearing ();
Assert.That (countAppearing, Is.EqualTo(1));
}
@@ -465,7 +464,7 @@ namespace Xamarin.Forms.Core.UnitTests
};
navPage.Appearing += (sender, e) => sentNav = true;
- navPage.SendAppearing ();
+ ((IPageController)navPage).SendAppearing ();
Assert.True (sentNav);
Assert.True (sent);
@@ -478,7 +477,7 @@ namespace Xamarin.Forms.Core.UnitTests
var page = new ContentPage ();
var navPage = new NavigationPage (page);
- navPage.SendAppearing ();
+ ((IPageController)navPage).SendAppearing ();
bool sentNav = false;
bool sent = false;
@@ -489,7 +488,7 @@ namespace Xamarin.Forms.Core.UnitTests
if (sent)
sentNav = true;
};
- navPage.SendDisappearing ();
+ ((IPageController)navPage).SendDisappearing ();
Assert.True (sentNav);
Assert.True (sent);
diff --git a/Xamarin.Forms.Core/AbsoluteLayout.cs b/Xamarin.Forms.Core/AbsoluteLayout.cs
index aceec2b..4392483 100644
--- a/Xamarin.Forms.Core/AbsoluteLayout.cs
+++ b/Xamarin.Forms.Core/AbsoluteLayout.cs
@@ -52,7 +52,7 @@ namespace Xamarin.Forms
protected override void LayoutChildren(double x, double y, double width, double height)
{
- foreach (View child in LogicalChildren)
+ foreach (View child in LogicalChildrenInternal)
{
Rectangle rect = ComputeLayoutForRegion(child, new Size(width, height));
rect.X += x;
@@ -79,7 +79,7 @@ namespace Xamarin.Forms
{
var bestFitSize = new Size();
var minimum = new Size();
- foreach (View child in LogicalChildren)
+ foreach (View child in LogicalChildrenInternal)
{
SizeRequest desiredSize = ComputeBoundingRegionDesiredSize(child);
diff --git a/Xamarin.Forms.Core/Application.cs b/Xamarin.Forms.Core/Application.cs
index 230b744..4b5a91a 100644
--- a/Xamarin.Forms.Core/Application.cs
+++ b/Xamarin.Forms.Core/Application.cs
@@ -94,7 +94,7 @@ namespace Xamarin.Forms
get { return _propertiesTask.Result; }
}
- internal override ReadOnlyCollection<Element> LogicalChildren
+ internal override ReadOnlyCollection<Element> LogicalChildrenInternal
{
get { return _logicalChildren ?? (_logicalChildren = new ReadOnlyCollection<Element>(InternalChildren)); }
}
diff --git a/Xamarin.Forms.Core/Cells/ViewCell.cs b/Xamarin.Forms.Core/Cells/ViewCell.cs
index 334822f..1ed35c9 100644
--- a/Xamarin.Forms.Core/Cells/ViewCell.cs
+++ b/Xamarin.Forms.Core/Cells/ViewCell.cs
@@ -43,6 +43,6 @@ namespace Xamarin.Forms
}
}
- internal override ReadOnlyCollection<Element> LogicalChildren => _logicalChildren ?? base.LogicalChildren;
+ internal override ReadOnlyCollection<Element> LogicalChildrenInternal => _logicalChildren ?? base.LogicalChildrenInternal;
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/ContentPresenter.cs b/Xamarin.Forms.Core/ContentPresenter.cs
index a99a048..5dce214 100644
--- a/Xamarin.Forms.Core/ContentPresenter.cs
+++ b/Xamarin.Forms.Core/ContentPresenter.cs
@@ -19,9 +19,9 @@ namespace Xamarin.Forms
protected override void LayoutChildren(double x, double y, double width, double height)
{
- for (var i = 0; i < LogicalChildren.Count; i++)
+ for (var i = 0; i < LogicalChildrenInternal.Count; i++)
{
- Element element = LogicalChildren[i];
+ Element element = LogicalChildrenInternal[i];
var child = element as View;
if (child != null)
LayoutChildIntoBoundingRegion(child, new Rectangle(x, y, width, height));
diff --git a/Xamarin.Forms.Core/Element.cs b/Xamarin.Forms.Core/Element.cs
index b631273..3bfa5cd 100644
--- a/Xamarin.Forms.Core/Element.cs
+++ b/Xamarin.Forms.Core/Element.cs
@@ -107,10 +107,9 @@ namespace Xamarin.Forms
}
}
- internal virtual ReadOnlyCollection<Element> LogicalChildren
- {
- get { return EmptyChildren; }
- }
+ internal virtual ReadOnlyCollection<Element> LogicalChildrenInternal => EmptyChildren;
+
+ ReadOnlyCollection<Element> IElementController.LogicalChildren => LogicalChildrenInternal;
internal bool Owned { get; set; }
@@ -310,9 +309,9 @@ namespace Xamarin.Forms
var gotBindingContext = false;
object bc = null;
- for (var index = 0; index < LogicalChildren.Count; index++)
+ for (var index = 0; index < LogicalChildrenInternal.Count; index++)
{
- Element child = LogicalChildren[index];
+ Element child = LogicalChildrenInternal[index];
if (!gotBindingContext)
{
@@ -386,7 +385,7 @@ namespace Xamarin.Forms
while (queue.Count > 0)
{
- ReadOnlyCollection<Element> children = queue.Dequeue().LogicalChildren;
+ ReadOnlyCollection<Element> children = queue.Dequeue().LogicalChildrenInternal;
for (var i = 0; i < children.Count; i++)
{
Element child = children[i];
@@ -480,7 +479,7 @@ namespace Xamarin.Forms
while (queue.Count > 0)
{
- ReadOnlyCollection<Element> children = queue.Dequeue().LogicalChildren;
+ ReadOnlyCollection<Element> children = queue.Dequeue().LogicalChildrenInternal;
for (var i = 0; i < children.Count; i++)
{
var child = children[i] as VisualElement;
diff --git a/Xamarin.Forms.Core/IElementController.cs b/Xamarin.Forms.Core/IElementController.cs
index 4e1ab10..41f229c 100644
--- a/Xamarin.Forms.Core/IElementController.cs
+++ b/Xamarin.Forms.Core/IElementController.cs
@@ -1,3 +1,5 @@
+using System.Collections.ObjectModel;
+
namespace Xamarin.Forms
{
public interface IElementController
@@ -6,5 +8,6 @@ namespace Xamarin.Forms
void SetValueFromRenderer(BindableProperty property, object value);
void SetValueFromRenderer(BindablePropertyKey propertyKey, object value);
+ ReadOnlyCollection<Element> LogicalChildren { get; }
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/IPageController.cs b/Xamarin.Forms.Core/IPageController.cs
new file mode 100644
index 0000000..298cffc
--- /dev/null
+++ b/Xamarin.Forms.Core/IPageController.cs
@@ -0,0 +1,17 @@
+using System.Collections.ObjectModel;
+
+namespace Xamarin.Forms
+{
+ public interface IPageController
+ {
+ Rectangle ContainerArea { get; set; }
+
+ bool IgnoresContainerArea { get; set; }
+
+ ObservableCollection<Element> InternalChildren { get; }
+
+ void SendAppearing();
+
+ void SendDisappearing();
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/Layout.cs b/Xamarin.Forms.Core/Layout.cs
index a98e46a..8c0d162 100644
--- a/Xamarin.Forms.Core/Layout.cs
+++ b/Xamarin.Forms.Core/Layout.cs
@@ -87,7 +87,7 @@ namespace Xamarin.Forms
internal ObservableCollection<Element> InternalChildren { get; } = new ObservableCollection<Element>();
- internal override ReadOnlyCollection<Element> LogicalChildren
+ internal override ReadOnlyCollection<Element> LogicalChildrenInternal
{
get { return _logicalChildren ?? (_logicalChildren = new ReadOnlyCollection<Element>(InternalChildren)); }
}
@@ -211,10 +211,10 @@ namespace Xamarin.Forms
if (!ShouldLayoutChildren())
return;
- var oldBounds = new Rectangle[LogicalChildren.Count];
+ var oldBounds = new Rectangle[LogicalChildrenInternal.Count];
for (var index = 0; index < oldBounds.Length; index++)
{
- var c = (VisualElement)LogicalChildren[index];
+ var c = (VisualElement)LogicalChildrenInternal[index];
oldBounds[index] = c.Bounds;
}
@@ -231,7 +231,7 @@ namespace Xamarin.Forms
for (var i = 0; i < oldBounds.Length; i++)
{
Rectangle oldBound = oldBounds[i];
- Rectangle newBound = ((VisualElement)LogicalChildren[i]).Bounds;
+ Rectangle newBound = ((VisualElement)LogicalChildrenInternal[i]).Bounds;
if (oldBound != newBound)
{
EventHandler handler = LayoutChanged;
@@ -278,11 +278,11 @@ namespace Xamarin.Forms
internal virtual void OnChildMeasureInvalidated(VisualElement child, InvalidationTrigger trigger)
{
- ReadOnlyCollection<Element> children = LogicalChildren;
+ ReadOnlyCollection<Element> children = LogicalChildrenInternal;
int count = children.Count;
for (var index = 0; index < count; index++)
{
- var v = LogicalChildren[index] as VisualElement;
+ var v = LogicalChildrenInternal[index] as VisualElement;
if (v != null && v.IsVisible && (!v.IsPlatformEnabled || !v.IsNativeStateConsistent))
return;
}
@@ -417,7 +417,7 @@ namespace Xamarin.Forms
bool ShouldLayoutChildren()
{
- if (!LogicalChildren.Any() || Width <= 0 || Height <= 0 || !IsVisible || !IsNativeStateConsistent || DisableLayout)
+ if (!LogicalChildrenInternal.Any() || Width <= 0 || Height <= 0 || !IsVisible || !IsNativeStateConsistent || DisableLayout)
return false;
foreach (Element element in VisibleDescendants())
diff --git a/Xamarin.Forms.Core/MasterDetailPage.cs b/Xamarin.Forms.Core/MasterDetailPage.cs
index 6885ece..61cc42d 100644
--- a/Xamarin.Forms.Core/MasterDetailPage.cs
+++ b/Xamarin.Forms.Core/MasterDetailPage.cs
@@ -22,6 +22,8 @@ namespace Xamarin.Forms
Rectangle _masterBounds;
+ IPageController PageController => this as IPageController;
+
public Page Detail
{
get { return _detail; }
@@ -38,9 +40,9 @@ namespace Xamarin.Forms
OnPropertyChanging();
if (_detail != null)
- InternalChildren.Remove(_detail);
+ PageController.InternalChildren.Remove(_detail);
_detail = value;
- InternalChildren.Add(_detail);
+ PageController.InternalChildren.Add(_detail);
OnPropertyChanged();
}
}
@@ -76,9 +78,9 @@ namespace Xamarin.Forms
OnPropertyChanging();
if (_master != null)
- InternalChildren.Remove(_master);
+ PageController.InternalChildren.Remove(_master);
_master = value;
- InternalChildren.Add(_master);
+ PageController.InternalChildren.Add(_master);
OnPropertyChanged();
}
}
diff --git a/Xamarin.Forms.Core/MultiPage.cs b/Xamarin.Forms.Core/MultiPage.cs
index 89fd7e9..a738249 100644
--- a/Xamarin.Forms.Core/MultiPage.cs
+++ b/Xamarin.Forms.Core/MultiPage.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using System.Runtime.CompilerServices;
@@ -23,6 +24,8 @@ namespace Xamarin.Forms
T _current;
+ ObservableCollection<Element> InternalChildren => ((IPageController)this).InternalChildren;
+
protected MultiPage()
{
_templatedItems = new TemplatedItemsList<MultiPage<T>, T>(this, ItemsSourceProperty, ItemTemplateProperty);
@@ -305,7 +308,7 @@ namespace Xamarin.Forms
void Reset()
{
- List<Element> snapshot = InternalChildren.ToList();
+ List <Element> snapshot = InternalChildren.ToList();
InternalChildren.Clear();
diff --git a/Xamarin.Forms.Core/NavigationPage.cs b/Xamarin.Forms.Core/NavigationPage.cs
index b13fc6c..85c8ac8 100644
--- a/Xamarin.Forms.Core/NavigationPage.cs
+++ b/Xamarin.Forms.Core/NavigationPage.cs
@@ -63,8 +63,8 @@ namespace Xamarin.Forms
{
get
{
- var result = new Stack<Page>(InternalChildren.Count);
- foreach (Page page in InternalChildren)
+ var result = new Stack<Page>(PageController.InternalChildren.Count);
+ foreach (Page page in PageController.InternalChildren)
result.Push(page);
return result;
}
@@ -72,9 +72,11 @@ namespace Xamarin.Forms
int INavigationPageController.StackDepth
{
- get { return InternalChildren.Count; }
+ get { return PageController.InternalChildren.Count; }
}
+ IPageController PageController => this as IPageController;
+
public Page CurrentPage
{
get { return (Page)GetValue(CurrentPageProperty); }
@@ -231,7 +233,7 @@ namespace Xamarin.Forms
return null;
}
- var page = (Page)InternalChildren.Last();
+ var page = (Page)PageController.InternalChildren.Last();
var args = new NavigationRequestedEventArgs(page, animated);
@@ -249,9 +251,9 @@ namespace Xamarin.Forms
if (!removed && !fast)
return CurrentPage;
- InternalChildren.Remove(page);
+ PageController.InternalChildren.Remove(page);
- CurrentPage = (Page)InternalChildren.Last();
+ CurrentPage = (Page)PageController.InternalChildren.Last();
if (Popped != null)
Popped(this, args);
@@ -293,18 +295,17 @@ namespace Xamarin.Forms
void InsertPageBefore(Page page, Page before)
{
- if (!InternalChildren.Contains(before))
+ if (!PageController.InternalChildren.Contains(before))
throw new ArgumentException("before must be a child of the NavigationPage", "before");
- if (InternalChildren.Contains(page))
+ if (PageController.InternalChildren.Contains(page))
throw new ArgumentException("Cannot insert page which is already in the navigation stack");
EventHandler<NavigationRequestedEventArgs> handler = InsertPageBeforeRequestedInternal;
- if (handler != null)
- handler(this, new NavigationRequestedEventArgs(page, before, false));
+ handler?.Invoke(this, new NavigationRequestedEventArgs(page, before, false));
- int index = InternalChildren.IndexOf(before);
- InternalChildren.Insert(index, page);
+ int index = PageController.InternalChildren.IndexOf(before);
+ PageController.InternalChildren.Insert(index, page);
// Shouldn't be required?
if (Width > 0 && Height > 0)
@@ -316,9 +317,9 @@ namespace Xamarin.Forms
if (((INavigationPageController)this).StackDepth == 1)
return;
- var root = (Page)InternalChildren.First();
+ var root = (Page)PageController.InternalChildren.First();
- InternalChildren.ToArray().Where(c => c != root).ForEach(c => InternalChildren.Remove(c));
+ PageController.InternalChildren.ToArray().Where(c => c != root).ForEach(c => PageController.InternalChildren.Remove(c));
CurrentPage = root;
@@ -339,7 +340,7 @@ namespace Xamarin.Forms
async Task PushAsyncInner(Page page, bool animated)
{
- if (InternalChildren.Contains(page))
+ if (PageController.InternalChildren.Contains(page))
return;
PushPage(page);
@@ -361,7 +362,7 @@ namespace Xamarin.Forms
void PushPage(Page page)
{
- InternalChildren.Add(page);
+ PageController.InternalChildren.Add(page);
CurrentPage = page;
}
@@ -377,14 +378,14 @@ namespace Xamarin.Forms
return;
}
- if (!InternalChildren.Contains(page))
+ if (!PageController.InternalChildren.Contains(page))
throw new ArgumentException("Page to remove must be contained on this Navigation Page");
EventHandler<NavigationRequestedEventArgs> handler = RemovePageRequestedInternal;
if (handler != null)
handler(this, new NavigationRequestedEventArgs(page, true));
- InternalChildren.Remove(page);
+ PageController.InternalChildren.Remove(page);
}
void SafePop()
@@ -403,7 +404,7 @@ namespace Xamarin.Forms
public NavigationImpl(NavigationPage owner)
{
Owner = owner;
- _castingList = new Lazy<ReadOnlyCastingList<Page, Element>>(() => new ReadOnlyCastingList<Page, Element>(Owner.InternalChildren));
+ _castingList = new Lazy<ReadOnlyCastingList<Page, Element>>(() => new ReadOnlyCastingList<Page, Element>(((IPageController)Owner).InternalChildren));
}
NavigationPage Owner { get; }
diff --git a/Xamarin.Forms.Core/Page.cs b/Xamarin.Forms.Core/Page.cs
index 2e1caf0..7c21a3b 100644
--- a/Xamarin.Forms.Core/Page.cs
+++ b/Xamarin.Forms.Core/Page.cs
@@ -11,13 +11,13 @@ using Xamarin.Forms.Platform;
namespace Xamarin.Forms
{
[RenderWith(typeof(_PageRenderer))]
- public class Page : VisualElement, ILayout
+ public class Page : VisualElement, ILayout, IPageController
{
- internal const string BusySetSignalName = "Xamarin.BusySet";
+ public const string BusySetSignalName = "Xamarin.BusySet";
- internal const string AlertSignalName = "Xamarin.SendAlert";
+ public const string AlertSignalName = "Xamarin.SendAlert";
- internal const string ActionSheetSignalName = "Xamarin.ShowActionSheet";
+ public const string ActionSheetSignalName = "Xamarin.ShowActionSheet";
internal static readonly BindableProperty IgnoresContainerAreaProperty = BindableProperty.Create("IgnoresContainerArea", typeof(bool), typeof(Page), false);
@@ -44,12 +44,15 @@ namespace Xamarin.Forms
ReadOnlyCollection<Element> _logicalChildren;
+ IPageController PageController => this as IPageController;
+ IElementController ElementController => this as IElementController;
+
public Page()
{
var toolbarItems = new ObservableCollection<ToolbarItem>();
toolbarItems.CollectionChanged += OnToolbarItemsCollectionChanged;
ToolbarItems = toolbarItems;
- InternalChildren.CollectionChanged += InternalChildrenOnCollectionChanged;
+ PageController.InternalChildren.CollectionChanged += InternalChildrenOnCollectionChanged;
}
public string BackgroundImage
@@ -84,7 +87,7 @@ namespace Xamarin.Forms
public IList<ToolbarItem> ToolbarItems { get; internal set; }
- internal Rectangle ContainerArea
+ Rectangle IPageController.ContainerArea
{
get { return _containerArea; }
set
@@ -97,18 +100,16 @@ namespace Xamarin.Forms
}
}
- internal bool IgnoresContainerArea
+ bool IPageController.IgnoresContainerArea
{
get { return (bool)GetValue(IgnoresContainerAreaProperty); }
set { SetValue(IgnoresContainerAreaProperty, value); }
}
- internal ObservableCollection<Element> InternalChildren { get; } = new ObservableCollection<Element>();
+ ObservableCollection<Element> IPageController.InternalChildren { get; } = new ObservableCollection<Element>();
- internal override ReadOnlyCollection<Element> LogicalChildren
- {
- get { return _logicalChildren ?? (_logicalChildren = new ReadOnlyCollection<Element>(InternalChildren)); }
- }
+ internal override ReadOnlyCollection<Element> LogicalChildrenInternal =>
+ _logicalChildren ?? (_logicalChildren = new ReadOnlyCollection<Element>(PageController.InternalChildren));
public event EventHandler LayoutChanged;
@@ -154,7 +155,7 @@ namespace Xamarin.Forms
Rectangle originalArea = area;
if (_containerAreaSet)
{
- area = ContainerArea;
+ area = PageController.ContainerArea;
area.X += Padding.Left;
area.Y += Padding.Right;
area.Width -= Padding.HorizontalThickness;
@@ -163,13 +164,13 @@ namespace Xamarin.Forms
area.Height = Math.Max(0, area.Height);
}
- foreach (Element element in LogicalChildren)
+ foreach (Element element in ElementController.LogicalChildren)
{
var child = element as VisualElement;
if (child == null)
continue;
var page = child as Page;
- if (page != null && page.IgnoresContainerArea)
+ if (page != null && ((IPageController)page).IgnoresContainerArea)
{
Forms.Layout.LayoutChildIntoBoundingRegion(child, originalArea);
}
@@ -237,8 +238,8 @@ namespace Xamarin.Forms
if (!ShouldLayoutChildren())
return;
- var startingLayout = new List<Rectangle>(LogicalChildren.Count);
- foreach (VisualElement c in LogicalChildren)
+ var startingLayout = new List<Rectangle>(ElementController.LogicalChildren.Count);
+ foreach (VisualElement c in ElementController.LogicalChildren)
{
startingLayout.Add(c.Bounds);
}
@@ -250,9 +251,9 @@ namespace Xamarin.Forms
LayoutChildren(x, y, w, h);
- for (var i = 0; i < LogicalChildren.Count; i++)
+ for (var i = 0; i < ElementController.LogicalChildren.Count; i++)
{
- var c = (VisualElement)LogicalChildren[i];
+ var c = (VisualElement)ElementController.LogicalChildren[i];
if (c.Bounds != startingLayout[i])
{
@@ -275,9 +276,9 @@ namespace Xamarin.Forms
}
else
{
- for (var i = 0; i < LogicalChildren.Count; i++)
+ for (var i = 0; i < ElementController.LogicalChildren.Count; i++)
{
- var v = LogicalChildren[i] as VisualElement;
+ var v = ElementController.LogicalChildren[i] as VisualElement;
if (v != null && v.IsVisible && (!v.IsPlatformEnabled || !v.IsNativeStateConsistent))
return;
}
@@ -291,7 +292,7 @@ namespace Xamarin.Forms
}
}
- internal void SendAppearing()
+ void IPageController.SendAppearing()
{
if (_hasAppeared)
return;
@@ -307,10 +308,10 @@ namespace Xamarin.Forms
handler(this, EventArgs.Empty);
var pageContainer = this as IPageContainer<Page>;
- pageContainer?.CurrentPage?.SendAppearing();
+ ((IPageController)pageContainer?.CurrentPage)?.SendAppearing();
}
- internal void SendDisappearing()
+ void IPageController.SendDisappearing()
{
if (!_hasAppeared)
return;
@@ -321,7 +322,7 @@ namespace Xamarin.Forms
MessagingCenter.Send(this, BusySetSignalName, false);
var pageContainer = this as IPageContainer<Page>;
- pageContainer?.CurrentPage?.SendDisappearing();
+ ((IPageController)pageContainer?.CurrentPage)?.SendDisappearing();
OnDisappearing();
EventHandler handler = Disappearing;
@@ -377,21 +378,21 @@ namespace Xamarin.Forms
bool ShouldLayoutChildren()
{
- if (!LogicalChildren.Any() || Width <= 0 || Height <= 0 || !IsNativeStateConsistent)
+ if (!ElementController.LogicalChildren.Any() || Width <= 0 || Height <= 0 || !IsNativeStateConsistent)
return false;
var container = this as IPageContainer<Page>;
- if (container != null && container.CurrentPage != null)
+ if (container?.CurrentPage != null)
{
- if (InternalChildren.Contains(container.CurrentPage))
+ if (PageController.InternalChildren.Contains(container.CurrentPage))
return container.CurrentPage.IsPlatformEnabled && container.CurrentPage.IsNativeStateConsistent;
return true;
}
var any = false;
- for (var i = 0; i < LogicalChildren.Count; i++)
+ for (var i = 0; i < ElementController.LogicalChildren.Count; i++)
{
- var v = LogicalChildren[i] as VisualElement;
+ var v = ElementController.LogicalChildren[i] as VisualElement;
if (v != null && (!v.IsPlatformEnabled || !v.IsNativeStateConsistent))
{
any = true;
diff --git a/Xamarin.Forms.Core/StackLayout.cs b/Xamarin.Forms.Core/StackLayout.cs
index e115a23..aa80797 100644
--- a/Xamarin.Forms.Core/StackLayout.cs
+++ b/Xamarin.Forms.Core/StackLayout.cs
@@ -46,9 +46,9 @@ namespace Xamarin.Forms
LayoutInformation layoutInformationCopy = _layoutInformation;
- for (var i = 0; i < LogicalChildren.Count; i++)
+ for (var i = 0; i < LogicalChildrenInternal.Count; i++)
{
- var child = (View)LogicalChildren[i];
+ var child = (View)LogicalChildrenInternal[i];
if (child.IsVisible)
LayoutChildIntoBoundingRegion(child, layoutInformationCopy.Plots[i], layoutInformationCopy.Requests[i]);
}
@@ -84,7 +84,7 @@ namespace Xamarin.Forms
{
for (var i = 0; i < layout.Plots.Length; i++)
{
- if (!((View)LogicalChildren[i]).IsVisible)
+ if (!((View)LogicalChildrenInternal[i]).IsVisible)
continue;
if (orientation == StackOrientation.Vertical)
{
@@ -131,9 +131,9 @@ namespace Xamarin.Forms
if (orientation == StackOrientation.Vertical)
{
View expander = null;
- for (var i = 0; i < LogicalChildren.Count; i++)
+ for (var i = 0; i < LogicalChildrenInternal.Count; i++)
{
- var child = (View)LogicalChildren[i];
+ var child = (View)LogicalChildrenInternal[i];
if (!child.IsVisible)
continue;
@@ -167,9 +167,9 @@ namespace Xamarin.Forms
else
{
View expander = null;
- for (var i = 0; i < LogicalChildren.Count; i++)
+ for (var i = 0; i < LogicalChildrenInternal.Count; i++)
{
- var child = (View)LogicalChildren[i];
+ var child = (View)LogicalChildrenInternal[i];
if (!child.IsVisible)
continue;
@@ -220,7 +220,7 @@ namespace Xamarin.Forms
for (var i = 0; i < layout.Plots.Length; i++)
{
- var child = (View)LogicalChildren[i];
+ var child = (View)LogicalChildrenInternal[i];
if (!child.IsVisible)
continue;
@@ -292,7 +292,7 @@ namespace Xamarin.Forms
for (var i = 0; i < layout.Plots.Length; i++)
{
- var child = (View)LogicalChildren[i];
+ var child = (View)LogicalChildrenInternal[i];
if (!child.IsVisible)
continue;
@@ -398,9 +398,9 @@ namespace Xamarin.Forms
double spacePerExpander = extraSpace / layout.Expanders;
double yOffset = 0;
- for (var i = 0; i < LogicalChildren.Count; i++)
+ for (var i = 0; i < LogicalChildrenInternal.Count; i++)
{
- var child = (View)LogicalChildren[i];
+ var child = (View)LogicalChildrenInternal[i];
if (!child.IsVisible)
continue;
Rectangle plot = layout.Plots[i];
@@ -426,9 +426,9 @@ namespace Xamarin.Forms
double spacePerExpander = extraSpace / layout.Expanders;
double xOffset = 0;
- for (var i = 0; i < LogicalChildren.Count; i++)
+ for (var i = 0; i < LogicalChildrenInternal.Count; i++)
{
- var child = (View)LogicalChildren[i];
+ var child = (View)LogicalChildrenInternal[i];
if (!child.IsVisible)
continue;
Rectangle plot = layout.Plots[i];
diff --git a/Xamarin.Forms.Core/TemplateUtilities.cs b/Xamarin.Forms.Core/TemplateUtilities.cs
index a965308..4a8d21b 100644
--- a/Xamarin.Forms.Core/TemplateUtilities.cs
+++ b/Xamarin.Forms.Core/TemplateUtilities.cs
@@ -88,7 +88,7 @@ namespace Xamarin.Forms
while (queue.Count > 0)
{
- ReadOnlyCollection<Element> children = queue.Dequeue().LogicalChildren;
+ ReadOnlyCollection<Element> children = queue.Dequeue().LogicalChildrenInternal;
for (var i = 0; i < children.Count; i++)
{
Element child = children[i];
diff --git a/Xamarin.Forms.Core/TemplatedPage.cs b/Xamarin.Forms.Core/TemplatedPage.cs
index 69c2d58..aa81151 100644
--- a/Xamarin.Forms.Core/TemplatedPage.cs
+++ b/Xamarin.Forms.Core/TemplatedPage.cs
@@ -13,7 +13,7 @@ namespace Xamarin.Forms
set { SetValue(ControlTemplateProperty, value); }
}
- IList<Element> IControlTemplated.InternalChildren => InternalChildren;
+ IList<Element> IControlTemplated.InternalChildren => ((IPageController)this).InternalChildren;
internal override void ComputeConstraintForView(View view)
{
diff --git a/Xamarin.Forms.Core/TemplatedView.cs b/Xamarin.Forms.Core/TemplatedView.cs
index 30dadb9..89543f2 100644
--- a/Xamarin.Forms.Core/TemplatedView.cs
+++ b/Xamarin.Forms.Core/TemplatedView.cs
@@ -18,9 +18,9 @@ namespace Xamarin.Forms
protected override void LayoutChildren(double x, double y, double width, double height)
{
- for (var i = 0; i < LogicalChildren.Count; i++)
+ for (var i = 0; i < LogicalChildrenInternal.Count; i++)
{
- Element element = LogicalChildren[i];
+ Element element = LogicalChildrenInternal[i];
var child = element as View;
if (child != null)
LayoutChildIntoBoundingRegion(child, new Rectangle(x, y, width, height));
diff --git a/Xamarin.Forms.Core/VisualElement.cs b/Xamarin.Forms.Core/VisualElement.cs
index da8b829..d8bcd3d 100644
--- a/Xamarin.Forms.Core/VisualElement.cs
+++ b/Xamarin.Forms.Core/VisualElement.cs
@@ -633,9 +633,9 @@ namespace Xamarin.Forms
internal void ComputeConstrainsForChildren()
{
- for (var i = 0; i < LogicalChildren.Count; i++)
+ for (var i = 0; i < LogicalChildrenInternal.Count; i++)
{
- var child = LogicalChildren[i] as View;
+ var child = LogicalChildrenInternal[i] as View;
if (child != null)
ComputeConstraintForView(child);
}
diff --git a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
index 1c11517..55b60bb 100644
--- a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
+++ b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
@@ -131,6 +131,7 @@
<Compile Include="Internals\InvalidationTrigger.cs" />
<Compile Include="InvalidNavigationException.cs" />
<Compile Include="IOpenGlViewController.cs" />
+ <Compile Include="IPageController.cs" />
<Compile Include="IPanGestureController.cs" />
<Compile Include="IPinchGestureController.cs" />
<Compile Include="IProvideParentValues.cs" />
diff --git a/Xamarin.Forms.Platform.Android/AppCompat/CarouselPageRenderer.cs b/Xamarin.Forms.Platform.Android/AppCompat/CarouselPageRenderer.cs
index a42d286..fb6d5b5 100644
--- a/Xamarin.Forms.Platform.Android/AppCompat/CarouselPageRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/AppCompat/CarouselPageRenderer.cs
@@ -24,6 +24,8 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
{
}
+ IPageController PageController => Element as IPageController;
+
void ViewPager.IOnPageChangeListener.OnPageSelected(int position)
{
Element.CurrentPage = Element.Children[position];
@@ -54,7 +56,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
}
if (Element != null)
- Element.InternalChildren.CollectionChanged -= OnChildrenCollectionChanged;
+ PageController.InternalChildren.CollectionChanged -= OnChildrenCollectionChanged;
}
base.Dispose(disposing);
@@ -63,13 +65,13 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
protected override void OnAttachedToWindow()
{
base.OnAttachedToWindow();
- Element.SendAppearing();
+ PageController.SendAppearing();
}
protected override void OnDetachedFromWindow()
{
base.OnDetachedFromWindow();
- Element.SendDisappearing();
+ PageController.SendDisappearing();
}
protected override void OnElementChanged(ElementChangedEventArgs<CarouselPage> e)
@@ -79,7 +81,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
var activity = (FormsAppCompatActivity)Context;
if (e.OldElement != null)
- e.OldElement.InternalChildren.CollectionChanged -= OnChildrenCollectionChanged;
+ ((IPageController)e.OldElement).InternalChildren.CollectionChanged -= OnChildrenCollectionChanged;
if (e.NewElement != null)
{
@@ -100,7 +102,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
if (carouselPage.CurrentPage != null)
ScrollToCurrentPage();
- carouselPage.InternalChildren.CollectionChanged += OnChildrenCollectionChanged;
+ ((IPageController)carouselPage).InternalChildren.CollectionChanged += OnChildrenCollectionChanged;
}
}
@@ -123,7 +125,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
if (width > 0 && height > 0)
{
- Element.ContainerArea = new Rectangle(0, 0, context.FromPixels(width), context.FromPixels(height));
+ PageController.ContainerArea = new Rectangle(0, 0, context.FromPixels(width), context.FromPixels(height));
pager.Layout(0, 0, width, b);
}
diff --git a/Xamarin.Forms.Platform.Android/AppCompat/FragmentContainer.cs b/Xamarin.Forms.Platform.Android/AppCompat/FragmentContainer.cs
index cc35b1a..34abfda 100644
--- a/Xamarin.Forms.Platform.Android/AppCompat/FragmentContainer.cs
+++ b/Xamarin.Forms.Platform.Android/AppCompat/FragmentContainer.cs
@@ -31,6 +31,8 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
public Page Page => (Page)_pageReference?.Target;
+ IPageController PageController => Page as IPageController;
+
public override bool UserVisibleHint
{
get { return base.UserVisibleHint; }
@@ -41,9 +43,9 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
return;
_isVisible = value;
if (_isVisible.Value)
- Page?.SendAppearing();
+ PageController?.SendAppearing();
else
- Page?.SendDisappearing();
+ PageController?.SendDisappearing();
}
}
@@ -106,20 +108,20 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
return;
if (hidden)
- Page.SendDisappearing();
+ PageController.SendDisappearing();
else
- Page.SendAppearing();
+ PageController.SendAppearing();
}
public override void OnPause()
{
- Page?.SendDisappearing();
+ PageController?.SendDisappearing();
base.OnPause();
}
public override void OnResume()
{
- Page?.SendAppearing();
+ PageController?.SendAppearing();
base.OnResume();
}
}
diff --git a/Xamarin.Forms.Platform.Android/AppCompat/FrameRenderer.cs b/Xamarin.Forms.Platform.Android/AppCompat/FrameRenderer.cs
index c2dd8e6..b57233b 100644
--- a/Xamarin.Forms.Platform.Android/AppCompat/FrameRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/AppCompat/FrameRenderer.cs
@@ -182,7 +182,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
if (Element == null)
return;
- var children = Element.LogicalChildren;
+ var children = ((IElementController)Element).LogicalChildren;
for (var i = 0; i < children.Count; i++)
{
var visualElement = children[i] as VisualElement;
diff --git a/Xamarin.Forms.Platform.Android/AppCompat/MasterDetailPageRenderer.cs b/Xamarin.Forms.Platform.Android/AppCompat/MasterDetailPageRenderer.cs
index 0173f48..1815321 100644
--- a/Xamarin.Forms.Platform.Android/AppCompat/MasterDetailPageRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/AppCompat/MasterDetailPageRenderer.cs
@@ -51,6 +51,10 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
}
}
+ IPageController MasterPageController => Element.Master as IPageController;
+ IPageController DetailPageController => Element.Detail as IPageController;
+ IPageController PageController => Element as IPageController;
+
void IDrawerListener.OnDrawerClosed(global::Android.Views.View drawerView)
{
}
@@ -212,13 +216,13 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
protected override void OnAttachedToWindow()
{
base.OnAttachedToWindow();
- Element.SendAppearing();
+ PageController.SendAppearing();
}
protected override void OnDetachedFromWindow()
{
base.OnDetachedFromWindow();
- Element.SendDisappearing();
+ PageController.SendDisappearing();
}
protected virtual void OnElementChanged(VisualElement oldElement, VisualElement newElement)
@@ -279,14 +283,14 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
void MasterDetailPageAppearing(object sender, EventArgs e)
{
- Element.Master?.SendAppearing();
- Element.Detail?.SendAppearing();
+ MasterPageController?.SendAppearing();
+ DetailPageController?.SendAppearing();
}
void MasterDetailPageDisappearing(object sender, EventArgs e)
{
- Element.Master?.SendDisappearing();
- Element.Detail?.SendDisappearing();
+ MasterPageController?.SendDisappearing();
+ DetailPageController?.SendDisappearing();
}
void OnBackButtonPressed(object sender, BackButtonPressedEventArgs backButtonPressedEventArgs)
diff --git a/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs b/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs
index 1132c8f..277be33 100644
--- a/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs
@@ -73,6 +73,8 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
FragmentManager FragmentManager => _fragmentManager ?? (_fragmentManager = ((FormsAppCompatActivity)Context).SupportFragmentManager);
+ IPageController PageController => Element as IPageController;
+
bool ToolbarVisible
{
get { return _toolbarVisible; }
@@ -130,9 +132,9 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
if (Element != null)
{
- for (var i = 0; i < Element.InternalChildren.Count; i++)
+ for (var i = 0; i < PageController.InternalChildren.Count; i++)
{
- var child = Element.InternalChildren[i] as VisualElement;
+ var child = PageController.InternalChildren[i] as VisualElement;
if (child == null)
continue;
IVisualElementRenderer renderer = Android.Platform.GetRenderer(child);
@@ -146,7 +148,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
navController.PopToRootRequested -= OnPoppedToRoot;
navController.InsertPageBeforeRequested -= OnInsertPageBeforeRequested;
navController.RemovePageRequested -= OnRemovePageRequested;
- Element.SendDisappearing();
+ PageController.SendDisappearing();
}
if (_toolbarTracker != null)
@@ -174,7 +176,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
protected override void OnAttachedToWindow()
{
base.OnAttachedToWindow();
- Element.SendAppearing();
+ PageController.SendAppearing();
_fragmentStack.Last().UserVisibleHint = true;
RegisterToolbar();
UpdateToolbar();
@@ -183,7 +185,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
protected override void OnDetachedFromWindow()
{
base.OnDetachedFromWindow();
- Element.SendDisappearing();
+ PageController.SendDisappearing();
}
protected override void OnElementChanged(ElementChangedEventArgs<NavigationPage> e)
@@ -272,7 +274,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
int containerHeight = ToolbarVisible ? internalHeight : b - t;
containerHeight -= ContainerPadding;
- Element.ContainerArea = new Rectangle(0, 0, Context.FromPixels(r - l), Context.FromPixels(containerHeight));
+ PageController.ContainerArea = new Rectangle(0, 0, Context.FromPixels(r - l), Context.FromPixels(containerHeight));
// Potential for optimization here, the exact conditions by which you don't need to do this are complex
// and the cost of doing when it's not needed is moderate to low since the layout will short circuit pretty fast
Element.ForceLayout();
@@ -393,7 +395,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
{
UpdateToolbar();
- int index = Element.InternalChildren.IndexOf(before);
+ int index = PageController.InternalChildren.IndexOf(before);
if (index == -1)
throw new InvalidOperationException("This should never happen, please file a bug");
@@ -464,7 +466,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
if (masterDetailPage == null)
{
- masterDetailPage = Element.InternalChildren[0] as MasterDetailPage;
+ masterDetailPage = PageController.InternalChildren[0] as MasterDetailPage;
if (masterDetailPage == null)
return;
}
diff --git a/Xamarin.Forms.Platform.Android/AppCompat/Platform.cs b/Xamarin.Forms.Platform.Android/AppCompat/Platform.cs
index 01e8dcc..0bad79b 100644
--- a/Xamarin.Forms.Platform.Android/AppCompat/Platform.cs
+++ b/Xamarin.Forms.Platform.Android/AppCompat/Platform.cs
@@ -41,6 +41,8 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
Page Page { get; set; }
+ IPageController CurrentPageController => _navModel.CurrentPage as IPageController;
+
public void Dispose()
{
if (_disposed)
@@ -79,7 +81,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
Task<Page> INavigation.PopModalAsync(bool animated)
{
Page modal = _navModel.PopModal();
- modal.SendDisappearing();
+ ((IPageController)modal).SendDisappearing();
var source = new TaskCompletionSource<Page>();
IVisualElementRenderer modalRenderer = Android.Platform.GetRenderer(modal);
@@ -95,7 +97,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
modalContainer.RemoveFromParent();
modalContainer.Dispose();
source.TrySetResult(modal);
- _navModel.CurrentPage?.SendAppearing();
+ CurrentPageController?.SendAppearing();
modalContainer = null;
}
});
@@ -105,7 +107,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
modalContainer.RemoveFromParent();
modalContainer.Dispose();
source.TrySetResult(modal);
- _navModel.CurrentPage?.SendAppearing();
+ CurrentPageController?.SendAppearing();
}
}
@@ -139,7 +141,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
async Task INavigation.PushModalAsync(Page modal, bool animated)
{
- _navModel.CurrentPage?.SendDisappearing();
+ CurrentPageController?.SendDisappearing();
_navModel.PushModal(modal);
@@ -151,7 +153,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
// Verify that the modal is still on the stack
if (_navModel.CurrentPage == modal)
- modal.SendAppearing();
+ ((IPageController)modal).SendAppearing();
}
void INavigation.RemovePage(Page page)
diff --git a/Xamarin.Forms.Platform.Android/AppCompat/TabbedPageRenderer.cs b/Xamarin.Forms.Platform.Android/AppCompat/TabbedPageRenderer.cs
index 4bd5490..243e5c1 100644
--- a/Xamarin.Forms.Platform.Android/AppCompat/TabbedPageRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/AppCompat/TabbedPageRenderer.cs
@@ -44,6 +44,8 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
}
}
+ IPageController PageController => Element as IPageController;
+
void IManageFragments.SetFragmentManager(FragmentManager childFragmentManager)
{
if (_fragmentManager == null)
@@ -114,7 +116,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
}
if (Element != null)
- Element.InternalChildren.CollectionChanged -= OnChildrenCollectionChanged;
+ PageController.InternalChildren.CollectionChanged -= OnChildrenCollectionChanged;
}
base.Dispose(disposing);
@@ -123,13 +125,13 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
protected override void OnAttachedToWindow()
{
base.OnAttachedToWindow();
- Element.SendAppearing();
+ PageController.SendAppearing();
}
protected override void OnDetachedFromWindow()
{
base.OnDetachedFromWindow();
- Element.SendDisappearing();
+ PageController.SendDisappearing();
}
protected override void OnElementChanged(ElementChangedEventArgs<TabbedPage> e)
@@ -139,7 +141,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
var activity = (FormsAppCompatActivity)Context;
if (e.OldElement != null)
- e.OldElement.InternalChildren.CollectionChanged -= OnChildrenCollectionChanged;
+ ((IPageController)e.OldElement).InternalChildren.CollectionChanged -= OnChildrenCollectionChanged;
if (e.NewElement != null)
{
@@ -177,7 +179,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
ScrollToCurrentPage();
UpdateIgnoreContainerAreas();
- tabbedPage.InternalChildren.CollectionChanged += OnChildrenCollectionChanged;
+ ((IPageController)tabbedPage).InternalChildren.CollectionChanged += OnChildrenCollectionChanged;
UpdateBarBackgroundColor();
UpdateBarTextColor();
}
@@ -216,11 +218,11 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
if (width > 0 && height > 0)
{
- Element.ContainerArea = new Rectangle(0, context.FromPixels(tabsHeight), context.FromPixels(width), context.FromPixels(height - tabsHeight));
+ PageController.ContainerArea = new Rectangle(0, context.FromPixels(tabsHeight), context.FromPixels(width), context.FromPixels(height - tabsHeight));
- for (var i = 0; i < Element.InternalChildren.Count; i++)
+ for (var i = 0; i < PageController.InternalChildren.Count; i++)
{
- var child = Element.InternalChildren[i] as VisualElement;
+ var child = PageController.InternalChildren[i] as VisualElement;
if (child == null)
continue;
IVisualElementRenderer renderer = Android.Platform.GetRenderer(child);
@@ -267,7 +269,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
void UpdateIgnoreContainerAreas()
{
- foreach (Page child in Element.Children)
+ foreach (IPageController child in Element.Children)
child.IgnoresContainerArea = child is NavigationPage;
}
@@ -275,16 +277,16 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
{
TabLayout tabs = _tabLayout;
- if (position >= Element.InternalChildren.Count)
+ if (position >= PageController.InternalChildren.Count)
return;
- var leftPage = (Page)Element.InternalChildren[position];
+ var leftPage = (Page)PageController.InternalChildren[position];
IVisualElementRenderer leftRenderer = Android.Platform.GetRenderer(leftPage);
if (leftRenderer == null)
return;
- if (offset <= 0 || position >= Element.InternalChildren.Count - 1)
+ if (offset <= 0 || position >= PageController.InternalChildren.Count - 1)
{
var leftNavRenderer = leftRenderer as NavigationPageRenderer;
if (leftNavRenderer != null)
@@ -294,7 +296,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
}
else
{
- var rightPage = (Page)Element.InternalChildren[position + 1];
+ var rightPage = (Page)PageController.InternalChildren[position + 1];
IVisualElementRenderer rightRenderer = Android.Platform.GetRenderer(rightPage);
var leftHeight = 0;
diff --git a/Xamarin.Forms.Platform.Android/Platform.cs b/Xamarin.Forms.Platform.Android/Platform.cs
index a37929f..65c3b8c 100644
--- a/Xamarin.Forms.Platform.Android/Platform.cs
+++ b/Xamarin.Forms.Platform.Android/Platform.cs
@@ -71,6 +71,8 @@ namespace Xamarin.Forms.Platform.Android
#endregion
+ IPageController CurrentPageController => _navModel.CurrentPage as IPageController;
+
ActionBar ActionBar
{
get { return ((Activity)_context).ActionBar; }
@@ -195,7 +197,7 @@ namespace Xamarin.Forms.Platform.Android
{
Page modal = _navModel.PopModal();
- modal.SendDisappearing();
+ ((IPageController)modal).SendDisappearing();
var source = new TaskCompletionSource<Page>();
IVisualElementRenderer modalRenderer = GetRenderer(modal);
@@ -210,7 +212,7 @@ namespace Xamarin.Forms.Platform.Android
modalRenderer.ViewGroup.RemoveFromParent();
modalRenderer.Dispose();
source.TrySetResult(modal);
- _navModel.CurrentPage?.SendAppearing();
+ CurrentPageController?.SendAppearing();
}
});
}
@@ -219,7 +221,7 @@ namespace Xamarin.Forms.Platform.Android
modalRenderer.ViewGroup.RemoveFromParent();
modalRenderer.Dispose();
source.TrySetResult(modal);
- _navModel.CurrentPage?.SendAppearing();
+ CurrentPageController?.SendAppearing();
}
}
@@ -256,7 +258,7 @@ namespace Xamarin.Forms.Platform.Android
async Task INavigation.PushModalAsync(Page modal, bool animated)
{
- _navModel.CurrentPage?.SendDisappearing();
+ CurrentPageController?.SendDisappearing();
_navModel.PushModal(modal);
@@ -266,7 +268,7 @@ namespace Xamarin.Forms.Platform.Android
// Verify that the modal is still on the stack
if (_navModel.CurrentPage == modal)
- modal.SendAppearing();
+ ((IPageController)modal).SendAppearing();
_toolbarTracker.Target = _navModel.Roots.Last();
@@ -563,7 +565,7 @@ namespace Xamarin.Forms.Platform.Android
result.AddRange(AncestorPagesOfPage(((MasterDetailPage)root).Detail));
else
{
- foreach (Page page in root.InternalChildren.OfType<Page>())
+ foreach (Page page in ((IPageController)root).InternalChildren.OfType<Page>())
result.AddRange(AncestorPagesOfPage(page));
}
diff --git a/Xamarin.Forms.Platform.Android/RendererPool.cs b/Xamarin.Forms.Platform.Android/RendererPool.cs
index 95a2877..447de3f 100644
--- a/Xamarin.Forms.Platform.Android/RendererPool.cs
+++ b/Xamarin.Forms.Platform.Android/RendererPool.cs
@@ -25,7 +25,7 @@ namespace Xamarin.Forms.Platform.Android
public void ClearChildrenRenderers()
{
- if (_parent.Element.LogicalChildren.Count == 0)
+ if (((IElementController)_parent.Element).LogicalChildren.Count == 0)
return;
ClearChildrenRenderers(_oldElement);
}
@@ -51,7 +51,7 @@ namespace Xamarin.Forms.Platform.Android
if (view == null)
return;
- foreach (Element logicalChild in view.LogicalChildren)
+ foreach (Element logicalChild in ((IElementController)view).LogicalChildren)
{
var child = logicalChild as VisualElement;
if (child != null)
diff --git a/Xamarin.Forms.Platform.Android/Renderers/CarouselPageAdapter.cs b/Xamarin.Forms.Platform.Android/Renderers/CarouselPageAdapter.cs
index 345501d..b7e98ba 100644
--- a/Xamarin.Forms.Platform.Android/Renderers/CarouselPageAdapter.cs
+++ b/Xamarin.Forms.Platform.Android/Renderers/CarouselPageAdapter.cs
@@ -15,6 +15,8 @@ namespace Xamarin.Forms.Platform.Android
bool _ignoreAndroidSelection;
CarouselPage _page;
+ IElementController ElementController => _page as IElementController;
+
public CarouselPageAdapter(ViewPager pager, CarouselPage page, Context context)
{
_pager = pager;
@@ -43,7 +45,7 @@ namespace Xamarin.Forms.Platform.Android
return;
int currentItem = _pager.CurrentItem;
- _page.CurrentPage = currentItem >= 0 && currentItem < _page.LogicalChildren.Count ? _page.LogicalChildren[currentItem] as ContentPage : null;
+ _page.CurrentPage = currentItem >= 0 && currentItem < ElementController.LogicalChildren.Count ? ElementController.LogicalChildren[currentItem] as ContentPage : null;
}
public override void DestroyItem(ViewGroup p0, int p1, Object p2)
@@ -117,7 +119,7 @@ namespace Xamarin.Forms.Platform.Android
{
if (disposing && _page != null)
{
- foreach (Element element in _page.LogicalChildren)
+ foreach (Element element in ElementController.LogicalChildren)
{
var childPage = element as VisualElement;
diff --git a/Xamarin.Forms.Platform.Android/Renderers/CarouselPageRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/CarouselPageRenderer.cs
index 859e78d..3774da0 100644
--- a/Xamarin.Forms.Platform.Android/Renderers/CarouselPageRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/Renderers/CarouselPageRenderer.cs
@@ -13,6 +13,8 @@ namespace Xamarin.Forms.Platform.Android
AutoPackage = false;
}
+ IPageController PageController => Element as IPageController;
+
protected override void Dispose(bool disposing)
{
if (disposing && _viewPager != null)
@@ -34,13 +36,13 @@ namespace Xamarin.Forms.Platform.Android
adapter.UpdateCurrentItem();
- Element.SendAppearing();
+ PageController.SendAppearing();
}
protected override void OnDetachedFromWindow()
{
base.OnDetachedFromWindow();
- Element.SendDisappearing();
+ PageController.SendDisappearing();
}
protected override void OnElementChanged(ElementChangedEventArgs<CarouselPage> e)
@@ -91,7 +93,7 @@ namespace Xamarin.Forms.Platform.Android
void UpdateCurrentItem()
{
int index = CarouselPage.GetIndex(Element.CurrentPage);
- if (index < 0 || index >= Element.LogicalChildren.Count)
+ if (index < 0 || index >= ((IElementController)Element).LogicalChildren.Count)
return;
_viewPager.CurrentItem = index;
diff --git a/Xamarin.Forms.Platform.Android/Renderers/ImageRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/ImageRenderer.cs
index fb51f15..1f8a776 100644
--- a/Xamarin.Forms.Platform.Android/Renderers/ImageRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/Renderers/ImageRenderer.cs
@@ -11,6 +11,8 @@ namespace Xamarin.Forms.Platform.Android
{
bool _isDisposed;
+ IElementController ElementController => Element as IElementController;
+
public ImageRenderer()
{
AutoPackage = false;
@@ -98,8 +100,7 @@ namespace Xamarin.Forms.Platform.Android
if (!_isDisposed)
{
Control.SetImageBitmap(bitmap);
- if (bitmap != null)
- bitmap.Dispose();
+ bitmap?.Dispose();
((IImageController)Element).SetIsLoading(false);
((IVisualElementController)Element).NativeSizeChanged();
diff --git a/Xamarin.Forms.Platform.Android/Renderers/MasterDetailRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/MasterDetailRenderer.cs
index 09c0c7c..ec9c620 100644
--- a/Xamarin.Forms.Platform.Android/Renderers/MasterDetailRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/Renderers/MasterDetailRenderer.cs
@@ -44,6 +44,10 @@ namespace Xamarin.Forms.Platform.Android
}
}
+ IPageController MasterPageController => _page.Master as IPageController;
+ IPageController DetailPageController => _page.Detail as IPageController;
+ IPageController PageController => Element as IPageController;
+
public void OnDrawerClosed(AView drawerView)
{
}
@@ -184,13 +188,13 @@ namespace Xamarin.Forms.Platform.Android
protected override void OnAttachedToWindow()
{
base.OnAttachedToWindow();
- ((Page)Element).SendAppearing();
+ PageController.SendAppearing();
}
protected override void OnDetachedFromWindow()
{
base.OnDetachedFromWindow();
- ((Page)Element).SendDisappearing();
+ PageController.SendDisappearing();
}
protected virtual void OnElementChanged(VisualElement oldElement, VisualElement newElement)
@@ -256,20 +260,14 @@ namespace Xamarin.Forms.Platform.Android
void MasterDetailPageAppearing(object sender, EventArgs e)
{
- if (_page.Master != null)
- _page.Master.SendAppearing();
-
- if (_page.Detail != null)
- _page.Detail.SendAppearing();
+ MasterPageController?.SendAppearing();
+ DetailPageController?.SendAppearing();
}
void MasterDetailPageDisappearing(object sender, EventArgs e)
{
- if (_page.Master != null)
- _page.Master.SendDisappearing();
-
- if (_page.Detail != null)
- _page.Detail.SendDisappearing();
+ MasterPageController?.SendDisappearing();
+ DetailPageController?.SendDisappearing();
}
void OnBackButtonPressed(object sender, BackButtonPressedEventArgs backButtonPressedEventArgs)
diff --git a/Xamarin.Forms.Platform.Android/Renderers/NavigationRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/NavigationRenderer.cs
index dc9a8fe..f326cb3 100644
--- a/Xamarin.Forms.Platform.Android/Renderers/NavigationRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/Renderers/NavigationRenderer.cs
@@ -35,11 +35,13 @@ namespace Xamarin.Forms.Platform.Android
return OnPushAsync(page, animated);
}
+ IPageController PageController => Element as IPageController;
+
protected override void Dispose(bool disposing)
{
if (disposing)
{
- foreach (VisualElement child in Element.InternalChildren)
+ foreach (VisualElement child in PageController.InternalChildren)
{
IVisualElementRenderer renderer = Platform.GetRenderer(child);
if (renderer != null)
@@ -64,13 +66,13 @@ namespace Xamarin.Forms.Platform.Android
protected override void OnAttachedToWindow()
{
base.OnAttachedToWindow();
- Element.SendAppearing();
+ PageController.SendAppearing();
}
protected override void OnDetachedFromWindow()
{
base.OnDetachedFromWindow();
- Element.SendDisappearing();
+ PageController.SendDisappearing();
}
protected override void OnElementChanged(ElementChangedEventArgs<NavigationPage> e)
@@ -132,7 +134,7 @@ namespace Xamarin.Forms.Platform.Android
void InsertPageBefore(Page page, Page before)
{
- int index = Element.InternalChildren.IndexOf(before);
+ int index = ((IPageController)Element).InternalChildren.IndexOf(before);
if (index == -1)
throw new InvalidOperationException("This should never happen, please file a bug");
@@ -220,9 +222,9 @@ namespace Xamarin.Forms.Platform.Android
{
// animate out
if (containerToAdd.Parent != this)
- AddView(containerToAdd, Element.LogicalChildren.IndexOf(rendererToAdd.Element));
+ AddView(containerToAdd, ((IElementController)Element).LogicalChildren.IndexOf(rendererToAdd.Element));
else
- ((Page)rendererToAdd.Element).SendAppearing();
+ ((IPageController)rendererToAdd.Element).SendAppearing();
containerToAdd.Visibility = ViewStates.Visible;
if (containerToRemove != null)
@@ -260,7 +262,7 @@ namespace Xamarin.Forms.Platform.Android
if (!containerAlreadyAdded)
AddView(containerToAdd);
else
- ((Page)rendererToAdd.Element).SendAppearing();
+ ((IPageController)rendererToAdd.Element).SendAppearing();
if (existing)
Element.ForceLayout();
@@ -273,8 +275,7 @@ namespace Xamarin.Forms.Platform.Android
if (containerToRemove != null && containerToRemove.Handle != IntPtr.Zero)
{
containerToRemove.Visibility = ViewStates.Gone;
- if (pageToRemove != null)
- pageToRemove.SendDisappearing();
+ ((IPageController)pageToRemove)?.SendDisappearing();
}
s_currentAnimation = null;
tcs.TrySetResult(true);
@@ -296,10 +297,10 @@ namespace Xamarin.Forms.Platform.Android
if (containerToAdd.Parent != this)
AddView(containerToAdd);
else
- ((Page)rendererToAdd.Element).SendAppearing();
+ ((IPageController)rendererToAdd.Element).SendAppearing();
if (containerToRemove != null && !removed)
- pageToRemove.SendDisappearing();
+ ((IPageController)pageToRemove).SendDisappearing();
if (existing)
Element.ForceLayout();
diff --git a/Xamarin.Forms.Platform.Android/Renderers/PageRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/PageRenderer.cs
index 24d85aa..7db4a4a 100644
--- a/Xamarin.Forms.Platform.Android/Renderers/PageRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/Renderers/PageRenderer.cs
@@ -12,9 +12,11 @@ namespace Xamarin.Forms.Platform.Android
return true;
}
+ IPageController PageController => Element as IPageController;
+
protected override void Dispose(bool disposing)
{
- Element?.SendDisappearing();
+ PageController?.SendDisappearing();
base.Dispose(disposing);
}
@@ -24,7 +26,7 @@ namespace Xamarin.Forms.Platform.Android
var pageContainer = Parent as PageContainer;
if (pageContainer != null && pageContainer.IsInFragment)
return;
- Element.SendAppearing();
+ PageController.SendAppearing();
}
protected override void OnDetachedFromWindow()
@@ -33,7 +35,7 @@ namespace Xamarin.Forms.Platform.Android
var pageContainer = Parent as PageContainer;
if (pageContainer != null && pageContainer.IsInFragment)
return;
- Element.SendDisappearing();
+ PageController.SendDisappearing();
}
protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
diff --git a/Xamarin.Forms.Platform.Android/Renderers/PickerRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/PickerRenderer.cs
index e9cc394..57d93b8 100644
--- a/Xamarin.Forms.Platform.Android/Renderers/PickerRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/Renderers/PickerRenderer.cs
@@ -23,6 +23,8 @@ namespace Xamarin.Forms.Platform.Android
AutoPackage = false;
}
+ IElementController ElementController => Element as IElementController;
+
protected override void Dispose(bool disposing)
{
if (disposing && !_isDisposed)
@@ -77,7 +79,7 @@ namespace Xamarin.Forms.Platform.Android
else if (_dialog != null)
{
_dialog.Hide();
- ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
+ ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
Control.ClearFocus();
_dialog = null;
}
@@ -101,14 +103,14 @@ namespace Xamarin.Forms.Platform.Android
var layout = new LinearLayout(Context) { Orientation = Orientation.Vertical };
layout.AddView(picker);
- ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
+ ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
var builder = new AlertDialog.Builder(Context);
builder.SetView(layout);
builder.SetTitle(model.Title ?? "");
builder.SetNegativeButton(global::Android.Resource.String.Cancel, (s, a) =>
{
- ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
+ ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
// It is possible for the Content of the Page to be changed when Focus is changed.
// In this case, we'll lose our Control.
Control?.ClearFocus();
@@ -116,14 +118,14 @@ namespace Xamarin.Forms.Platform.Android
});
builder.SetPositiveButton(global::Android.Resource.String.Ok, (s, a) =>
{
- ((IElementController)Element).SetValueFromRenderer(Picker.SelectedIndexProperty, picker.Value);
+ ElementController.SetValueFromRenderer(Picker.SelectedIndexProperty, picker.Value);
// It is possible for the Content of the Page to be changed on SelectedIndexChanged.
// In this case, the Element & Control will no longer exist.
if (Element != null)
{
if (model.Items.Count > 0 && Element.SelectedIndex >= 0)
Control.Text = model.Items[Element.SelectedIndex];
- ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
+ ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
// It is also possible for the Content of the Page to be changed when Focus is changed.
// In this case, we'll lose our Control.
Control?.ClearFocus();
diff --git a/Xamarin.Forms.Platform.Android/Renderers/TabbedRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/TabbedRenderer.cs
index 35404a6..f2878a8 100644
--- a/Xamarin.Forms.Platform.Android/Renderers/TabbedRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/Renderers/TabbedRenderer.cs
@@ -11,6 +11,8 @@ namespace Xamarin.Forms.Platform.Android
AutoPackage = false;
}
+ IPageController PageController => Element as IPageController;
+
protected override void Dispose(bool disposing)
{
if (disposing && Element != null && Element.Children.Count > 0)
@@ -31,13 +33,13 @@ namespace Xamarin.Forms.Platform.Android
protected override void OnAttachedToWindow()
{
base.OnAttachedToWindow();
- Element.SendAppearing();
+ PageController.SendAppearing();
}
protected override void OnDetachedFromWindow()
{
base.OnDetachedFromWindow();
- Element.SendDisappearing();
+ PageController.SendDisappearing();
}
protected override void OnElementChanged(ElementChangedEventArgs<TabbedPage> e)
diff --git a/Xamarin.Forms.Platform.Android/Renderers/TimePickerRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/TimePickerRenderer.cs
index 010eda7..4cb5d2d 100644
--- a/Xamarin.Forms.Platform.Android/Renderers/TimePickerRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/Renderers/TimePickerRenderer.cs
@@ -19,11 +19,13 @@ namespace Xamarin.Forms.Platform.Android
AutoPackage = false;
}
+ IElementController ElementController => Element as IElementController;
+
void TimePickerDialog.IOnTimeSetListener.OnTimeSet(ATimePicker view, int hourOfDay, int minute)
{
- ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
+ ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
- ((IElementController)Element).SetValueFromRenderer(TimePicker.TimeProperty, new TimeSpan(hourOfDay, minute, 0));
+ ElementController.SetValueFromRenderer(TimePicker.TimeProperty, new TimeSpan(hourOfDay, minute, 0));
Control.ClearFocus();
_dialog = null;
}
@@ -66,7 +68,7 @@ namespace Xamarin.Forms.Platform.Android
else if (_dialog != null)
{
_dialog.Hide();
- ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
+ ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
Control.ClearFocus();
_dialog = null;
}
@@ -75,7 +77,7 @@ namespace Xamarin.Forms.Platform.Android
void OnClick()
{
TimePicker view = Element;
- ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
+ ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
_dialog = new TimePickerDialog(Context, this, view.Time.Hours, view.Time.Minutes, false);
_dialog.Show();
diff --git a/Xamarin.Forms.Platform.Android/VisualElementPackager.cs b/Xamarin.Forms.Platform.Android/VisualElementPackager.cs
index e7e6ab6..e6db1c6 100644
--- a/Xamarin.Forms.Platform.Android/VisualElementPackager.cs
+++ b/Xamarin.Forms.Platform.Android/VisualElementPackager.cs
@@ -29,6 +29,8 @@ namespace Xamarin.Forms.Platform.Android
_renderer.ElementChanged += (sender, args) => SetElement(args.OldElement, args.NewElement);
}
+ IElementController ElementController => _renderer.Element as IElementController;
+
public void Dispose()
{
if (_disposed)
@@ -96,9 +98,9 @@ namespace Xamarin.Forms.Platform.Android
void EnsureChildOrder()
{
- for (var i = 0; i < _renderer.Element.LogicalChildren.Count; i++)
+ for (var i = 0; i < ElementController.LogicalChildren.Count; i++)
{
- Element child = _renderer.Element.LogicalChildren[i];
+ Element child = ElementController.LogicalChildren[i];
var element = (VisualElement)child;
if (element != null)
{
@@ -113,7 +115,8 @@ namespace Xamarin.Forms.Platform.Android
var view = e.Element as VisualElement;
if (view != null)
AddChild(view);
- if (_renderer.Element.LogicalChildren[_renderer.Element.LogicalChildren.Count - 1] != view)
+
+ if (ElementController.LogicalChildren[ElementController.LogicalChildren.Count - 1] != view)
EnsureChildOrder();
}
@@ -155,8 +158,8 @@ namespace Xamarin.Forms.Platform.Android
{
sameChildrenTypes = true;
- oldChildren = oldElement.LogicalChildren;
- newChildren = newElement.LogicalChildren;
+ oldChildren = ((IElementController)oldElement).LogicalChildren;
+ newChildren = ((IElementController)newElement).LogicalChildren;
if (oldChildren.Count == newChildren.Count)
{
for (var i = 0; i < oldChildren.Count; i++)
@@ -193,7 +196,7 @@ namespace Xamarin.Forms.Platform.Android
newElement.ChildrenReordered += _childReorderedHandler;
- newChildren = newChildren ?? newElement.LogicalChildren;
+ newChildren = newChildren ?? ((IElementController)newElement).LogicalChildren;
for (var i = 0; i < newChildren.Count; i++)
{
diff --git a/Xamarin.Forms.Platform.Android/VisualElementRenderer.cs b/Xamarin.Forms.Platform.Android/VisualElementRenderer.cs
index 893adca..5274f89 100644
--- a/Xamarin.Forms.Platform.Android/VisualElementRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/VisualElementRenderer.cs
@@ -306,7 +306,7 @@ namespace Xamarin.Forms.Platform.Android
if (Element == null)
return;
- ReadOnlyCollection<Element> children = Element.LogicalChildren;
+ ReadOnlyCollection<Element> children = ((IElementController)Element).LogicalChildren;
for (var i = 0; i < children.Count; i++)
{
var visualElement = children[i] as VisualElement;
diff --git a/Xamarin.Forms.Platform.UAP/MasterDetailPageRenderer.cs b/Xamarin.Forms.Platform.UAP/MasterDetailPageRenderer.cs
index 6f54e80..c424c7f 100644
--- a/Xamarin.Forms.Platform.UAP/MasterDetailPageRenderer.cs
+++ b/Xamarin.Forms.Platform.UAP/MasterDetailPageRenderer.cs
@@ -55,6 +55,8 @@ namespace Xamarin.Forms.Platform.UWP
{
set { Control.ToolbarForeground = value; }
}
+
+IPageController PageController => Element as IPageController;
IMasterDetailPageController MasterDetailPageController => Element as IMasterDetailPageController;
@@ -196,16 +198,13 @@ namespace Xamarin.Forms.Platform.UWP
if (Element == null)
return;
- Element.SendAppearing();
+ PageController.SendAppearing();
UpdateBounds();
}
void OnControlUnlaoded(object sender, RoutedEventArgs routedEventArgs)
{
- if (Element == null)
- return;
-
- Element.SendDisappearing();
+ PageController?.SendDisappearing();
}
void OnDetailPropertyChanged(object sender, PropertyChangedEventArgs e)
diff --git a/Xamarin.Forms.Platform.UAP/TabbedPageRenderer.cs b/Xamarin.Forms.Platform.UAP/TabbedPageRenderer.cs
index cde4071..7a9f181 100644
--- a/Xamarin.Forms.Platform.UAP/TabbedPageRenderer.cs
+++ b/Xamarin.Forms.Platform.UAP/TabbedPageRenderer.cs
@@ -20,20 +20,20 @@ namespace Xamarin.Forms.Platform.UWP
if (ActualWidth > 0 && ActualHeight > 0)
{
var tab = (Page)DataContext;
- ((TabbedPage)tab.RealParent).ContainerArea = new Rectangle(0, 0, ActualWidth, ActualHeight);
+ ((IPageController)tab.RealParent).ContainerArea = new Rectangle(0, 0, ActualWidth, ActualHeight);
}
};
}
void TabbedPagePresenter_Loaded(object sender, RoutedEventArgs e)
{
- var tab = (Page)DataContext;
+ var tab = (IPageController)DataContext;
tab.SendAppearing();
}
void TabbedPagePresenter_Unloaded(object sender, RoutedEventArgs e)
{
- var tab = (Page)DataContext;
+ var tab = (IPageController)DataContext;
tab.SendDisappearing();
}
}
@@ -78,6 +78,8 @@ namespace Xamarin.Forms.Platform.UWP
set { (Control as FormsPivot).ToolbarForeground = value; }
}
+ IPageController PageController => Element as IPageController;
+
bool ITitleProvider.ShowTitle
{
get { return _showTitle; }
@@ -190,7 +192,7 @@ namespace Xamarin.Forms.Platform.UWP
return;
_disposed = true;
- Element?.SendDisappearing();
+ PageController?.SendDisappearing();
SetElement(null);
Tracker = null;
}
@@ -215,10 +217,7 @@ namespace Xamarin.Forms.Platform.UWP
void OnLoaded(object sender, RoutedEventArgs args)
{
- if (Element == null)
- return;
-
- Element.SendAppearing();
+ PageController?.SendAppearing();
}
void OnPagesChanged(object sender, NotifyCollectionChangedEventArgs e)
@@ -238,17 +237,14 @@ namespace Xamarin.Forms.Platform.UWP
Page currentPage = Element.CurrentPage;
if (currentPage == page)
return;
- currentPage?.SendDisappearing();
+ ((IPageController)currentPage)?.SendDisappearing();
Element.CurrentPage = page;
- page?.SendAppearing();
+ ((IPageController)page)?.SendAppearing();
}
void OnUnloaded(object sender, RoutedEventArgs args)
{
- if (Element == null)
- return;
-
- Element.SendDisappearing();
+ PageController?.SendDisappearing();
}
Brush GetBarBackgroundBrush()
diff --git a/Xamarin.Forms.Platform.WP8/CarouselPageRenderer.cs b/Xamarin.Forms.Platform.WP8/CarouselPageRenderer.cs
index 29446c4..26cf2c1 100644
--- a/Xamarin.Forms.Platform.WP8/CarouselPageRenderer.cs
+++ b/Xamarin.Forms.Platform.WP8/CarouselPageRenderer.cs
@@ -75,7 +75,7 @@ namespace Xamarin.Forms.Platform.WinPhone
if (element.ActualWidth > 0 && element.ActualHeight > 0)
{
var carouselItem = (Page)DataContext;
- ((CarouselPage)carouselItem.RealParent).ContainerArea = new Rectangle(0, 0, element.ActualWidth, element.ActualHeight);
+ ((IPageController)carouselItem.RealParent).ContainerArea = new Rectangle(0, 0, element.ActualWidth, element.ActualHeight);
}
};
}
@@ -132,8 +132,8 @@ namespace Xamarin.Forms.Platform.WinPhone
_page.PagesChanged += OnPagesChanged;
_page.PropertyChanged += OnPropertyChanged;
- Loaded += (sender, args) => _page.SendAppearing();
- Unloaded += (sender, args) => _page.SendDisappearing();
+ Loaded += (sender, args) => ((IPageController)_page).SendAppearing();
+ Unloaded += (sender, args) => ((IPageController)_page).SendDisappearing();
OnElementChanged(new VisualElementChangedEventArgs(oldElement, element));
}
diff --git a/Xamarin.Forms.Platform.WP8/ImageRenderer.cs b/Xamarin.Forms.Platform.WP8/ImageRenderer.cs
index 9a758c1..ebc50ad 100644
--- a/Xamarin.Forms.Platform.WP8/ImageRenderer.cs
+++ b/Xamarin.Forms.Platform.WP8/ImageRenderer.cs
@@ -27,6 +27,8 @@ namespace Xamarin.Forms.Platform.WinPhone
public class ImageRenderer : ViewRenderer<Image, System.Windows.Controls.Image>
{
+ IElementController ElementController => Element as IElementController;
+
public override SizeRequest GetDesiredSize(double widthConstraint, double heightConstraint)
{
// Someone reported a NRE happening in this method which can only be explained by Control being null
diff --git a/Xamarin.Forms.Platform.WP8/MasterDetailRenderer.cs b/Xamarin.Forms.Platform.WP8/MasterDetailRenderer.cs
index 25ca846..9f05cb8 100644
--- a/Xamarin.Forms.Platform.WP8/MasterDetailRenderer.cs
+++ b/Xamarin.Forms.Platform.WP8/MasterDetailRenderer.cs
@@ -24,6 +24,8 @@ namespace Xamarin.Forms.Platform.WinPhone
public bool Visible { get; private set; }
+ IPageController PageController => Element as IPageController;
+
protected override System.Windows.Size ArrangeOverride(System.Windows.Size finalSize)
{
UpdateSizes(finalSize.Width, finalSize.Height);
@@ -49,11 +51,11 @@ namespace Xamarin.Forms.Platform.WinPhone
{
if (Element.IsPresented)
Toggle();
- Element.SendAppearing();
+ PageController.SendAppearing();
};
Unloaded += (sender, args) =>
{
- Element.SendDisappearing();
+ PageController.SendDisappearing();
if (Visible)
{
var platform = (Platform)Element.Platform;
diff --git a/Xamarin.Forms.Platform.WP8/NavigationPageRenderer.cs b/Xamarin.Forms.Platform.WP8/NavigationPageRenderer.cs
index 2bd5b7b..1637b1d 100644
--- a/Xamarin.Forms.Platform.WP8/NavigationPageRenderer.cs
+++ b/Xamarin.Forms.Platform.WP8/NavigationPageRenderer.cs
@@ -19,6 +19,9 @@ namespace Xamarin.Forms.Platform.WinPhone
AutoPackage = false;
}
+ IPageController PageController => Element as IPageController;
+ IElementController ElementController => Element as IElementController;
+
protected override void OnElementChanged(ElementChangedEventArgs<NavigationPage> e)
{
base.OnElementChanged(e);
@@ -37,9 +40,10 @@ namespace Xamarin.Forms.Platform.WinPhone
Element.PropertyChanged += OnElementPropertyChanged;
var platform = (Platform)Element.Platform;
- Element.ContainerArea = new Rectangle(new Point(0, 0), platform.Size);
- platform.SizeChanged += (sender, args) => Element.ContainerArea = new Rectangle(new Point(0, 0), platform.Size);
+ PageController.ContainerArea = new Rectangle(new Point(0, 0), platform.Size);
+
+ platform.SizeChanged += (sender, args) => PageController.ContainerArea = new Rectangle(new Point(0, 0), platform.Size);
List<Page> stack = GetStack();
if (stack.Count > 0)
@@ -59,7 +63,7 @@ namespace Xamarin.Forms.Platform.WinPhone
else
init();
- Loaded += (sender, args) => Element.SendAppearing();
+ Loaded += (sender, args) => PageController.SendAppearing();
Unloaded += OnUnloaded;
}
@@ -79,10 +83,10 @@ namespace Xamarin.Forms.Platform.WinPhone
List<Page> GetStack()
{
- int count = Element.InternalChildren.Count;
+ int count = PageController.InternalChildren.Count;
var stack = new List<Page>(count);
for (var i = 0; i < count; i++)
- stack.Add((Page)Element.InternalChildren[i]);
+ stack.Add((Page)PageController.InternalChildren[i]);
return stack;
}
@@ -97,9 +101,9 @@ namespace Xamarin.Forms.Platform.WinPhone
if (platform == null)
return;
- for (var i = 0; i < Element.LogicalChildren.Count; i++)
+ for (var i = 0; i < ElementController.LogicalChildren.Count; i++)
{
- var page = Element.LogicalChildren[i] as Page;
+ var page = ElementController.LogicalChildren[i] as Page;
if (page != null)
platform.RemovePage(page, false);
}
@@ -107,7 +111,7 @@ namespace Xamarin.Forms.Platform.WinPhone
void OnUnloaded(object sender, RoutedEventArgs args)
{
- Element.SendDisappearing();
+ PageController.SendDisappearing();
}
void PageOnPopped(object sender, NavigationRequestedEventArgs eventArg)
@@ -136,7 +140,7 @@ namespace Xamarin.Forms.Platform.WinPhone
if (platform != null)
{
if (e.Page == ((INavigationPageController)Element).StackCopy.LastOrDefault())
- e.Page.IgnoresContainerArea = true;
+ ((IPageController)e.Page).IgnoresContainerArea = true;
e.Task = platform.PushCore(e.Page, Element, e.Animated, e.Realize).ContinueWith((t, o) => true, null);
}
}
@@ -169,7 +173,7 @@ namespace Xamarin.Forms.Platform.WinPhone
{
Children.RemoveAt(0);
- var page = renderer.Element as Page;
+ var page = renderer.Element as IPageController;
if (page != null)
page.IgnoresContainerArea = false;
@@ -183,7 +187,7 @@ namespace Xamarin.Forms.Platform.WinPhone
if (first == null)
return;
- first.IgnoresContainerArea = true;
+ ((IPageController)first).IgnoresContainerArea = true;
IVisualElementRenderer firstRenderer = Platform.GetRenderer(first);
if (firstRenderer == null)
diff --git a/Xamarin.Forms.Platform.WP8/PageRenderer.cs b/Xamarin.Forms.Platform.WP8/PageRenderer.cs
index 6ba89ab..8d31446 100644
--- a/Xamarin.Forms.Platform.WP8/PageRenderer.cs
+++ b/Xamarin.Forms.Platform.WP8/PageRenderer.cs
@@ -11,8 +11,8 @@ namespace Xamarin.Forms.Platform.WinPhone
base.OnElementChanged(e);
- Loaded += (sender, args) => Element.SendAppearing();
- Unloaded += (sender, args) => Element.SendDisappearing();
+ Loaded += (sender, args) => ((IPageController)Element).SendAppearing();
+ Unloaded += (sender, args) => ((IPageController)Element).SendDisappearing();
}
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.WP8/PickerRenderer.cs b/Xamarin.Forms.Platform.WP8/PickerRenderer.cs
index d52f731..5dc1d83 100644
--- a/Xamarin.Forms.Platform.WP8/PickerRenderer.cs
+++ b/Xamarin.Forms.Platform.WP8/PickerRenderer.cs
@@ -15,6 +15,8 @@ namespace Xamarin.Forms.Platform.WinPhone
FormsListPicker _listPicker;
Brush _defaultBrush;
+ IElementController ElementController => Element as IElementController;
+
protected override void OnElementChanged(ElementChangedEventArgs<Picker> e)
{
_listPicker = new FormsListPicker();
@@ -134,12 +136,12 @@ namespace Xamarin.Forms.Platform.WinPhone
if (oldVal == ListPickerMode.Normal && newVal == ListPickerMode.Full)
{
// Picker Page is now showing
- ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
+ ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
}
else if (oldVal == ListPickerMode.Full && newVal == ListPickerMode.Normal)
{
// PickerPage is now dismissed
- ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
+ ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
}
}
@@ -165,7 +167,7 @@ namespace Xamarin.Forms.Platform.WinPhone
return;
int elementSelectedIndex = picker.SelectedIndex - 1;
- ((IElementController)Element).SetValueFromRenderer(Picker.SelectedIndexProperty, elementSelectedIndex);
+ ElementController.SetValueFromRenderer(Picker.SelectedIndexProperty, elementSelectedIndex);
}
void UpdateAlignment()
diff --git a/Xamarin.Forms.Platform.WP8/Platform.cs b/Xamarin.Forms.Platform.WP8/Platform.cs
index cda86bc..00623b4 100644
--- a/Xamarin.Forms.Platform.WP8/Platform.cs
+++ b/Xamarin.Forms.Platform.WP8/Platform.cs
@@ -248,7 +248,7 @@ namespace Xamarin.Forms.Platform.WinPhone
var parent = current.Parent as NavigationPage;
if (parent != null)
{
- if (parent.InternalChildren[0] == current)
+ if (((IPageController)parent).InternalChildren[0] == current)
replaceWithRoot = true;
}
diff --git a/Xamarin.Forms.Platform.WP8/StepperRenderer.cs b/Xamarin.Forms.Platform.WP8/StepperRenderer.cs
index b459305..a0193c3 100644
--- a/Xamarin.Forms.Platform.WP8/StepperRenderer.cs
+++ b/Xamarin.Forms.Platform.WP8/StepperRenderer.cs
@@ -12,6 +12,8 @@ namespace Xamarin.Forms.Platform.WinPhone
WButton _downButton;
WButton _upButton;
+ IElementController ElementController => Element as IElementController;
+
protected override void OnElementChanged(ElementChangedEventArgs<Stepper> e)
{
base.OnElementChanged(e);
@@ -51,12 +53,12 @@ namespace Xamarin.Forms.Platform.WinPhone
void DownButtonOnClick(object sender, RoutedEventArgs routedEventArgs)
{
- ((IElementController)Element).SetValueFromRenderer(Stepper.ValueProperty, Math.Max(Element.Minimum, Element.Value - Element.Increment));
+ ElementController.SetValueFromRenderer(Stepper.ValueProperty, Math.Max(Element.Minimum, Element.Value - Element.Increment));
}
void UpButtonOnClick(object sender, RoutedEventArgs routedEventArgs)
{
- ((IElementController)Element).SetValueFromRenderer(Stepper.ValueProperty, Math.Min(Element.Maximum, Element.Value + Element.Increment));
+ ElementController.SetValueFromRenderer(Stepper.ValueProperty, Math.Min(Element.Maximum, Element.Value + Element.Increment));
}
void UpdateButtons()
diff --git a/Xamarin.Forms.Platform.WP8/SwitchRenderer.cs b/Xamarin.Forms.Platform.WP8/SwitchRenderer.cs
index e64fe22..653cd0a 100644
--- a/Xamarin.Forms.Platform.WP8/SwitchRenderer.cs
+++ b/Xamarin.Forms.Platform.WP8/SwitchRenderer.cs
@@ -9,14 +9,16 @@ namespace Xamarin.Forms.Platform.WinPhone
{
readonly ToggleSwitchButton _toggleSwitch = new ToggleSwitchButton();
+ IElementController ElementController => Element as IElementController;
+
protected override void OnElementChanged(ElementChangedEventArgs<Switch> e)
{
base.OnElementChanged(e);
var container = new Border { Child = _toggleSwitch };
_toggleSwitch.IsChecked = Element.IsToggled;
- _toggleSwitch.Checked += (sender, args) => ((IElementController)Element).SetValueFromRenderer(Switch.IsToggledProperty, true);
- _toggleSwitch.Unchecked += (sender, args) => ((IElementController)Element).SetValueFromRenderer(Switch.IsToggledProperty, false);
+ _toggleSwitch.Checked += (sender, args) => ElementController.SetValueFromRenderer(Switch.IsToggledProperty, true);
+ _toggleSwitch.Unchecked += (sender, args) => ElementController.SetValueFromRenderer(Switch.IsToggledProperty, false);
_toggleSwitch.HorizontalAlignment = HorizontalAlignment.Right;
SetNativeControl(container);
diff --git a/Xamarin.Forms.Platform.WP8/TabbedPageRenderer.cs b/Xamarin.Forms.Platform.WP8/TabbedPageRenderer.cs
index 9192fc6..6d796e9 100644
--- a/Xamarin.Forms.Platform.WP8/TabbedPageRenderer.cs
+++ b/Xamarin.Forms.Platform.WP8/TabbedPageRenderer.cs
@@ -26,7 +26,7 @@ namespace Xamarin.Forms.Platform.WinPhone
if (pivotItem.ActualWidth > 0 && pivotItem.ActualHeight > 0)
{
var tab = (Page)DataContext;
- ((TabbedPage)tab.RealParent).ContainerArea = new Rectangle(0, 0, pivotItem.ActualWidth, pivotItem.ActualHeight);
+ ((IPageController)tab.RealParent).ContainerArea = new Rectangle(0, 0, pivotItem.ActualWidth, pivotItem.ActualHeight);
}
};
}
@@ -74,8 +74,8 @@ namespace Xamarin.Forms.Platform.WinPhone
_page.PropertyChanged += OnPropertyChanged;
- Loaded += (sender, args) => _page.SendAppearing();
- Unloaded += (sender, args) => _page.SendDisappearing();
+ Loaded += (sender, args) => ((IPageController)_page).SendAppearing();
+ Unloaded += (sender, args) => ((IPageController)_page).SendDisappearing();
OnElementChanged(new VisualElementChangedEventArgs(_page, element));
}
diff --git a/Xamarin.Forms.Platform.WP8/VisualElementPackager.cs b/Xamarin.Forms.Platform.WP8/VisualElementPackager.cs
index 65f589f..95e8037 100644
--- a/Xamarin.Forms.Platform.WP8/VisualElementPackager.cs
+++ b/Xamarin.Forms.Platform.WP8/VisualElementPackager.cs
@@ -22,6 +22,8 @@ namespace Xamarin.Forms.Platform.WinPhone
_renderer = renderer;
}
+ IElementController ElementController => _renderer.Element as IElementController;
+
public void Load()
{
if (_loaded)
@@ -32,15 +34,15 @@ namespace Xamarin.Forms.Platform.WinPhone
_renderer.Element.ChildRemoved += HandleChildRemoved;
_renderer.Element.ChildrenReordered += HandleChildrenReordered;
- foreach (Element child in _renderer.Element.LogicalChildren)
+ foreach (Element child in ElementController.LogicalChildren)
HandleChildAdded(_renderer.Element, new ElementEventArgs(child));
}
void EnsureZIndex()
{
- for (var index = 0; index < _renderer.Element.LogicalChildren.Count; index++)
+ for (var index = 0; index < ElementController.LogicalChildren.Count; index++)
{
- var child = (VisualElement)_renderer.Element.LogicalChildren[index];
+ var child = (VisualElement)ElementController.LogicalChildren[index];
IVisualElementRenderer r = Platform.GetRenderer(child);
if (r == null)
continue;
diff --git a/Xamarin.Forms.Platform.WP8/VisualElementRenderer.cs b/Xamarin.Forms.Platform.WP8/VisualElementRenderer.cs
index aca47d6..93788ad 100644
--- a/Xamarin.Forms.Platform.WP8/VisualElementRenderer.cs
+++ b/Xamarin.Forms.Platform.WP8/VisualElementRenderer.cs
@@ -15,6 +15,8 @@ namespace Xamarin.Forms.Platform.WinPhone
VisualElementTracker _tracker;
+ IElementController ElementController => Element as IElementController;
+
public TNativeElement Control { get; private set; }
public TElement Element { get; private set; }
@@ -139,9 +141,9 @@ namespace Xamarin.Forms.Platform.WinPhone
Control.Arrange(new Rect(0, 0, finalSize.Width, finalSize.Height));
}
- for (var i = 0; i < Element.LogicalChildren.Count; i++)
+ for (var i = 0; i < ElementController.LogicalChildren.Count; i++)
{
- var child = Element.LogicalChildren[i] as VisualElement;
+ var child = ElementController.LogicalChildren[i] as VisualElement;
if (child == null)
continue;
IVisualElementRenderer renderer = Platform.GetRenderer(child);
@@ -164,9 +166,9 @@ namespace Xamarin.Forms.Platform.WinPhone
Element.IsInNativeLayout = true;
- for (var i = 0; i < Element.LogicalChildren.Count; i++)
+ for (var i = 0; i < ElementController.LogicalChildren.Count; i++)
{
- var child = Element.LogicalChildren[i] as VisualElement;
+ var child = ElementController.LogicalChildren[i] as VisualElement;
if (child == null)
continue;
IVisualElementRenderer renderer = Platform.GetRenderer(child);
@@ -227,12 +229,12 @@ namespace Xamarin.Forms.Platform.WinPhone
protected virtual void OnGotFocus(object sender, RoutedEventArgs args)
{
- ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
+ ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
}
protected virtual void OnLostFocus(object sender, RoutedEventArgs args)
{
- ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
+ ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
}
protected virtual void OnRegisterEffect(PlatformEffect effect)
diff --git a/Xamarin.Forms.Platform.WinRT.Phone/TabbedPageRenderer.cs b/Xamarin.Forms.Platform.WinRT.Phone/TabbedPageRenderer.cs
index a733730..fa0e6c2 100644
--- a/Xamarin.Forms.Platform.WinRT.Phone/TabbedPageRenderer.cs
+++ b/Xamarin.Forms.Platform.WinRT.Phone/TabbedPageRenderer.cs
@@ -16,7 +16,7 @@ namespace Xamarin.Forms.Platform.WinRT
if (ActualWidth > 0 && ActualHeight > 0)
{
var tab = ((Page)DataContext);
- ((TabbedPage)tab.RealParent).ContainerArea = new Rectangle(0, 0, ActualWidth, ActualHeight);
+ ((IPageController)tab.RealParent).ContainerArea = new Rectangle(0, 0, ActualWidth, ActualHeight);
}
};
}
@@ -259,7 +259,7 @@ namespace Xamarin.Forms.Platform.WinRT
if (Element == null)
return;
- Element.SendAppearing();
+ ((IPageController)Element).SendAppearing();
}
void OnUnloaded(object sender, RoutedEventArgs args)
@@ -267,7 +267,7 @@ namespace Xamarin.Forms.Platform.WinRT
if (Element == null)
return;
- Element.SendDisappearing();
+ ((IPageController)Element).SendDisappearing();
}
void OnTrackerUpdated(object sender, EventArgs e)
diff --git a/Xamarin.Forms.Platform.WinRT.Tablet/TabbedPageRenderer.cs b/Xamarin.Forms.Platform.WinRT.Tablet/TabbedPageRenderer.cs
index f1df081..e89e18c 100644
--- a/Xamarin.Forms.Platform.WinRT.Tablet/TabbedPageRenderer.cs
+++ b/Xamarin.Forms.Platform.WinRT.Tablet/TabbedPageRenderer.cs
@@ -22,6 +22,8 @@ namespace Xamarin.Forms.Platform.WinRT
get { return (TabbedPage)Element; }
}
+ IPageController PageController => Element as IPageController;
+
protected VisualElementTracker<Page, Canvas> Tracker
{
get { return _tracker; }
@@ -205,7 +207,7 @@ namespace Xamarin.Forms.Platform.WinRT
return;
ShowTabs();
- Page.SendAppearing();
+ PageController.SendAppearing();
}
Windows.UI.Xaml.Controls.Page GetTopPage()
@@ -262,8 +264,7 @@ namespace Xamarin.Forms.Platform.WinRT
void OnUnloaded(object sender, RoutedEventArgs args)
{
RemoveTabs();
- if (Page != null)
- Page.SendDisappearing();
+ PageController?.SendDisappearing();
}
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.WinRT/CarouselPageRenderer.cs b/Xamarin.Forms.Platform.WinRT/CarouselPageRenderer.cs
index 97733cf..7fe0ba0 100644
--- a/Xamarin.Forms.Platform.WinRT/CarouselPageRenderer.cs
+++ b/Xamarin.Forms.Platform.WinRT/CarouselPageRenderer.cs
@@ -46,6 +46,8 @@ namespace Xamarin.Forms.Platform.WinRT
get { return Element; }
}
+ IPageController PageController => Element as IPageController;
+
public event EventHandler<VisualElementChangedEventArgs> ElementChanged;
public SizeRequest GetDesiredSize(double widthConstraint, double heightConstraint)
@@ -78,7 +80,7 @@ namespace Xamarin.Forms.Platform.WinRT
if (oldPage != null)
{
- oldPage.SendDisappearing();
+ ((IPageController)oldPage).SendDisappearing();
((INotifyCollectionChanged)oldPage.Children).CollectionChanged -= OnChildrenChanged;
oldPage.PropertyChanged -= OnElementPropertyChanged;
}
@@ -103,7 +105,7 @@ namespace Xamarin.Forms.Platform.WinRT
newPage.PropertyChanged += OnElementPropertyChanged;
UpdateCurrentPage();
- newPage.SendAppearing();
+ ((IPageController)newPage).SendAppearing();
}
OnElementChanged(new ElementChangedEventArgs<CarouselPage>(oldPage, newPage));
@@ -124,7 +126,7 @@ namespace Xamarin.Forms.Platform.WinRT
}
_disposed = true;
- Element?.SendDisappearing();
+ PageController?.SendDisappearing();
SetElement(null);
}
@@ -150,7 +152,7 @@ namespace Xamarin.Forms.Platform.WinRT
void OnLoaded(object sender, RoutedEventArgs e)
{
- Element?.SendAppearing();
+ PageController?.SendAppearing();
}
void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
@@ -162,14 +164,14 @@ namespace Xamarin.Forms.Platform.WinRT
ContentPage currentPage = Element.CurrentPage;
if (currentPage == page)
return;
- currentPage?.SendDisappearing();
+ ((IPageController)currentPage)?.SendDisappearing();
Element.CurrentPage = page;
- page?.SendAppearing();
+ ((IPageController)page)?.SendAppearing();
}
void OnUnloaded(object sender, RoutedEventArgs e)
{
- Element?.SendDisappearing();
+ PageController?.SendDisappearing();
}
void UpdateCurrentPage()
diff --git a/Xamarin.Forms.Platform.WinRT/MasterDetailPageRenderer.cs b/Xamarin.Forms.Platform.WinRT/MasterDetailPageRenderer.cs
index 87b8cd7..abc614b 100644
--- a/Xamarin.Forms.Platform.WinRT/MasterDetailPageRenderer.cs
+++ b/Xamarin.Forms.Platform.WinRT/MasterDetailPageRenderer.cs
@@ -40,6 +40,8 @@ namespace Xamarin.Forms.Platform.WinRT
get { return Device.Idiom == TargetIdiom.Phone; }
}
+ IPageController PageController => Element as IPageController;
+
public void Dispose()
{
Dispose(true);
@@ -173,10 +175,7 @@ namespace Xamarin.Forms.Platform.WinRT
void OnLoaded(object sender, RoutedEventArgs args)
{
- if (Element == null)
- return;
-
- Element.SendAppearing();
+ PageController?.SendAppearing();
}
void OnNativeSizeChanged(object sender, SizeChangedEventArgs e)
@@ -186,10 +185,7 @@ namespace Xamarin.Forms.Platform.WinRT
void OnUnloaded(object sender, RoutedEventArgs args)
{
- if (Element == null)
- return;
-
- Element.SendDisappearing();
+ PageController?.SendDisappearing();
}
void OnUserClosedPopover(object sender, EventArgs e)
diff --git a/Xamarin.Forms.Platform.WinRT/NavigationPageRenderer.cs b/Xamarin.Forms.Platform.WinRT/NavigationPageRenderer.cs
index 6e8edf5..b5bf487 100644
--- a/Xamarin.Forms.Platform.WinRT/NavigationPageRenderer.cs
+++ b/Xamarin.Forms.Platform.WinRT/NavigationPageRenderer.cs
@@ -86,6 +86,8 @@ namespace Xamarin.Forms.Platform.WinRT
}
}
+ IPageController PageController => Element as IPageController;
+
bool ITitleProvider.ShowTitle
{
get { return _showTitle; }
@@ -158,7 +160,7 @@ namespace Xamarin.Forms.Platform.WinRT
((INavigationPageController)oldElement).PushRequested -= OnPushRequested;
((INavigationPageController)oldElement).PopRequested -= OnPopRequested;
((INavigationPageController)oldElement).PopToRootRequested -= OnPopToRootRequested;
- oldElement.InternalChildren.CollectionChanged -= OnChildrenChanged;
+ ((IPageController)oldElement).InternalChildren.CollectionChanged -= OnChildrenChanged;
oldElement.PropertyChanged -= OnElementPropertyChanged;
}
@@ -189,7 +191,7 @@ namespace Xamarin.Forms.Platform.WinRT
((INavigationPageController)Element).PushRequested += OnPushRequested;
((INavigationPageController)Element).PopRequested += OnPopRequested;
((INavigationPageController)Element).PopToRootRequested += OnPopToRootRequested;
- Element.InternalChildren.CollectionChanged += OnChildrenChanged;
+ PageController.InternalChildren.CollectionChanged += OnChildrenChanged;
if (!string.IsNullOrEmpty(Element.AutomationId))
_container.SetValue(AutomationProperties.AutomationIdProperty, Element.AutomationId);
@@ -204,7 +206,7 @@ namespace Xamarin.Forms.Platform.WinRT
{
if (!disposing || _disposed)
return;
- Element?.SendDisappearing();
+ PageController?.SendDisappearing();
_disposed = true;
_container.PointerPressed -= OnPointerPressed;
@@ -344,7 +346,7 @@ namespace Xamarin.Forms.Platform.WinRT
#if WINDOWS_UWP
_navManager = SystemNavigationManager.GetForCurrentView();
#endif
- Element.SendAppearing();
+ PageController.SendAppearing();
UpdateBackButton();
UpdateTitleOnParents();
}
@@ -375,7 +377,7 @@ namespace Xamarin.Forms.Platform.WinRT
void OnPopRequested(object sender, NavigationRequestedEventArgs e)
{
- var newCurrent = (Page)Element.InternalChildren[Element.InternalChildren.Count - 2];
+ var newCurrent = (Page)PageController.InternalChildren[PageController.InternalChildren.Count - 2];
SetPage(newCurrent, e.Animated, true);
}
@@ -391,10 +393,7 @@ namespace Xamarin.Forms.Platform.WinRT
void OnUnloaded(object sender, RoutedEventArgs args)
{
- if (Element == null)
- return;
-
- Element.SendDisappearing();
+ PageController?.SendDisappearing();
}
void PushExistingNavigationStack()
@@ -448,7 +447,7 @@ namespace Xamarin.Forms.Platform.WinRT
void UpdateBackButton()
{
- bool showBackButton = Element.InternalChildren.Count > 1 && NavigationPage.GetHasBackButton(_currentPage);
+ bool showBackButton = PageController.InternalChildren.Count > 1 && NavigationPage.GetHasBackButton(_currentPage);
_container.ShowBackButton = showBackButton;
#if WINDOWS_UWP
@@ -470,7 +469,7 @@ namespace Xamarin.Forms.Platform.WinRT
void UpdateContainerArea()
{
- Element.ContainerArea = new Rectangle(0, 0, _container.ContentWidth, _container.ContentHeight);
+ PageController.ContainerArea = new Rectangle(0, 0, _container.ContentWidth, _container.ContentHeight);
}
void UpdateNavigationBarBackground()
diff --git a/Xamarin.Forms.Platform.WinRT/PageRenderer.cs b/Xamarin.Forms.Platform.WinRT/PageRenderer.cs
index d33ff02..708c13b 100644
--- a/Xamarin.Forms.Platform.WinRT/PageRenderer.cs
+++ b/Xamarin.Forms.Platform.WinRT/PageRenderer.cs
@@ -15,6 +15,8 @@ namespace Xamarin.Forms.Platform.WinRT
bool _loaded;
+ IPageController PageController => Element as IPageController;
+
protected override void Dispose(bool disposing)
{
if (!disposing || _disposed)
@@ -24,13 +26,13 @@ namespace Xamarin.Forms.Platform.WinRT
if (Element != null)
{
- ReadOnlyCollection<Element> children = Element.LogicalChildren;
+ ReadOnlyCollection<Element> children = ((IElementController)Element).LogicalChildren;
for (var i = 0; i < children.Count; i++)
{
var visualChild = children[i] as VisualElement;
visualChild?.Cleanup();
}
- Element?.SendDisappearing();
+ PageController?.SendDisappearing();
}
base.Dispose();
@@ -40,10 +42,7 @@ namespace Xamarin.Forms.Platform.WinRT
{
base.OnElementChanged(e);
- if (e.OldElement != null)
- {
- e.OldElement.SendDisappearing();
- }
+ ((IPageController)e.OldElement)?.SendDisappearing();
if (e.NewElement != null)
{
@@ -56,7 +55,7 @@ namespace Xamarin.Forms.Platform.WinRT
}
if (_loaded)
- e.NewElement.SendAppearing();
+ ((IPageController)e.NewElement).SendAppearing();
}
}
@@ -68,13 +67,13 @@ namespace Xamarin.Forms.Platform.WinRT
return;
}
_loaded = true;
- Element?.SendAppearing();
+ PageController?.SendAppearing();
}
void OnUnloaded(object sender, RoutedEventArgs args)
{
_loaded = false;
- Element?.SendDisappearing();
+ PageController?.SendDisappearing();
}
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.WinRT/ViewToRendererConverter.cs b/Xamarin.Forms.Platform.WinRT/ViewToRendererConverter.cs
index 2d8a4f9..3895052 100644
--- a/Xamarin.Forms.Platform.WinRT/ViewToRendererConverter.cs
+++ b/Xamarin.Forms.Platform.WinRT/ViewToRendererConverter.cs
@@ -97,7 +97,7 @@ namespace Xamarin.Forms.Platform.WinRT
var wrapperAwareRenderer = currentRenderer as IWrapperAware;
wrapperAwareRenderer?.NotifyWrapped();
- foreach (Element child in currentView.LogicalChildren)
+ foreach (Element child in ((IElementController)currentView).LogicalChildren)
{
var childView = child as View;
if (childView == null)
diff --git a/Xamarin.Forms.Platform.WinRT/VisualElementPackager.cs b/Xamarin.Forms.Platform.WinRT/VisualElementPackager.cs
index 1c4036e..686da58 100644
--- a/Xamarin.Forms.Platform.WinRT/VisualElementPackager.cs
+++ b/Xamarin.Forms.Platform.WinRT/VisualElementPackager.cs
@@ -42,6 +42,8 @@ namespace Xamarin.Forms.Platform.WinRT
_columnSpan = columnSpan;
}
+ IElementController ElementController => _renderer.Element as IElementController;
+
public void Dispose()
{
if (_disposed)
@@ -66,7 +68,7 @@ namespace Xamarin.Forms.Platform.WinRT
_renderer.Element.ChildAdded += OnChildAdded;
_renderer.Element.ChildRemoved += OnChildRemoved;
- ReadOnlyCollection<Element> children = _renderer.Element.LogicalChildren;
+ ReadOnlyCollection<Element> children = ElementController.LogicalChildren;
for (var i = 0; i < children.Count; i++)
{
OnChildAdded(_renderer.Element, new ElementEventArgs(children[i]));
@@ -75,12 +77,12 @@ namespace Xamarin.Forms.Platform.WinRT
void EnsureZIndex()
{
- if (_renderer.Element.LogicalChildren.Count == 0)
+ if (ElementController.LogicalChildren.Count == 0)
return;
- for (var z = 0; z < _renderer.Element.LogicalChildren.Count; z++)
+ for (var z = 0; z < ElementController.LogicalChildren.Count; z++)
{
- var child = _renderer.Element.LogicalChildren[z] as VisualElement;
+ var child = ElementController.LogicalChildren[z] as VisualElement;
if (child == null)
continue;
diff --git a/Xamarin.Forms.Platform.WinRT/VisualElementRenderer.cs b/Xamarin.Forms.Platform.WinRT/VisualElementRenderer.cs
index 96565d7..3ad826b 100644
--- a/Xamarin.Forms.Platform.WinRT/VisualElementRenderer.cs
+++ b/Xamarin.Forms.Platform.WinRT/VisualElementRenderer.cs
@@ -28,6 +28,8 @@ namespace Xamarin.Forms.Platform.WinRT
protected bool AutoTrack { get; set; } = true;
+ IElementController ElementController => Element as IElementController;
+
protected VisualElementTracker<TElement, TNativeElement> Tracker
{
get { return _tracker; }
@@ -163,9 +165,9 @@ namespace Xamarin.Forms.Platform.WinRT
Control.Arrange(new Rect(0, 0, finalSize.Width, finalSize.Height));
}
- for (var i = 0; i < Element.LogicalChildren.Count; i++)
+ for (var i = 0; i < ElementController.LogicalChildren.Count; i++)
{
- var child = Element.LogicalChildren[i] as VisualElement;
+ var child = ElementController.LogicalChildren[i] as VisualElement;
if (child == null)
continue;
IVisualElementRenderer renderer = Platform.GetRenderer(child);
@@ -205,9 +207,9 @@ namespace Xamarin.Forms.Platform.WinRT
Element.IsInNativeLayout = true;
- for (var i = 0; i < Element.LogicalChildren.Count; i++)
+ for (var i = 0; i < ElementController.LogicalChildren.Count; i++)
{
- var child = Element.LogicalChildren[i] as VisualElement;
+ var child = ElementController.LogicalChildren[i] as VisualElement;
if (child == null)
continue;
IVisualElementRenderer renderer = Platform.GetRenderer(child);
diff --git a/Xamarin.Forms.Platform.iOS/RendererPool.cs b/Xamarin.Forms.Platform.iOS/RendererPool.cs
index 25df358..51f7f4f 100644
--- a/Xamarin.Forms.Platform.iOS/RendererPool.cs
+++ b/Xamarin.Forms.Platform.iOS/RendererPool.cs
@@ -53,8 +53,8 @@ namespace Xamarin.Forms.Platform.iOS
var sameChildrenTypes = true;
- var oldChildren = _oldElement.LogicalChildren;
- var newChildren = newElement.LogicalChildren;
+ var oldChildren = ((IElementController)_oldElement).LogicalChildren;
+ var newChildren = ((IElementController)newElement).LogicalChildren;
if (oldChildren.Count == newChildren.Count)
{
@@ -102,7 +102,7 @@ namespace Xamarin.Forms.Platform.iOS
void FillChildrenWithRenderers(VisualElement element)
{
- foreach (var logicalChild in element.LogicalChildren)
+ foreach (var logicalChild in ((IElementController)element).LogicalChildren)
{
var child = logicalChild as VisualElement;
if (child != null)
@@ -128,7 +128,9 @@ namespace Xamarin.Forms.Platform.iOS
void UpdateRenderers(Element newElement)
{
- if (newElement.LogicalChildren.Count == 0)
+ var newElementController = (IElementController)newElement;
+
+ if (newElementController.LogicalChildren.Count == 0)
return;
var subviews = _parent.NativeView.Subviews;
@@ -139,7 +141,7 @@ namespace Xamarin.Forms.Platform.iOS
continue;
var x = (int)childRenderer.NativeView.Layer.ZPosition / 1000;
- var element = newElement.LogicalChildren[x] as VisualElement;
+ var element = newElementController.LogicalChildren[x] as VisualElement;
if (element == null)
continue;
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs
index 16e97cd..6e7c6b2 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs
@@ -37,11 +37,15 @@ namespace Xamarin.Forms.Platform.iOS
WantsFullScreenLayout = true;
}
+ IElementController ElementController => Element as IElementController;
+
protected CarouselPage Carousel
{
get { return (CarouselPage)Element; }
}
+ IPageController PageController => (IPageController)Element;
+
protected int SelectedIndex
{
get { return (int)(_scrollView.ContentOffset.X / _scrollView.Frame.Width); }
@@ -98,7 +102,7 @@ namespace Xamarin.Forms.Platform.iOS
return;
_appeared = true;
- Carousel.SendAppearing();
+ PageController.SendAppearing();
}
public override void ViewDidDisappear(bool animated)
@@ -109,7 +113,7 @@ namespace Xamarin.Forms.Platform.iOS
return;
_appeared = false;
- Carousel.SendDisappearing();
+ PageController.SendDisappearing();
}
public override void ViewDidLayoutSubviews()
@@ -139,9 +143,9 @@ namespace Xamarin.Forms.Platform.iOS
View.Add(_scrollView);
- for (var i = 0; i < Element.LogicalChildren.Count; i++)
+ for (var i = 0; i < ElementController.LogicalChildren.Count; i++)
{
- Element element = Element.LogicalChildren[i];
+ Element element = ElementController.LogicalChildren[i];
var child = element as ContentPage;
if (child != null)
InsertPage(child, i);
@@ -199,7 +203,7 @@ namespace Xamarin.Forms.Platform.iOS
if (_appeared)
{
_appeared = false;
- Carousel.SendDisappearing();
+ PageController?.SendDisappearing();
}
if (_events != null)
@@ -266,10 +270,10 @@ namespace Xamarin.Forms.Platform.iOS
void OnDecelerationEnded(object sender, EventArgs eventArgs)
{
- if (_ignoreNativeScrolling || SelectedIndex >= Element.LogicalChildren.Count)
+ if (_ignoreNativeScrolling || SelectedIndex >= ElementController.LogicalChildren.Count)
return;
- Carousel.CurrentPage = (ContentPage)Element.LogicalChildren[SelectedIndex];
+ Carousel.CurrentPage = (ContentPage)ElementController.LogicalChildren[SelectedIndex];
}
void OnPagesChanged(object sender, NotifyCollectionChangedEventArgs e)
@@ -335,9 +339,9 @@ namespace Xamarin.Forms.Platform.iOS
{
Clear();
- for (var i = 0; i < Element.LogicalChildren.Count; i++)
+ for (var i = 0; i < ElementController.LogicalChildren.Count; i++)
{
- Element element = Element.LogicalChildren[i];
+ Element element = ElementController.LogicalChildren[i];
var child = element as ContentPage;
if (child != null)
InsertPage(child, i);
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/DatePickerRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/DatePickerRenderer.cs
index 6d70d7c..a591243 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/DatePickerRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/DatePickerRenderer.cs
@@ -38,6 +38,8 @@ namespace Xamarin.Forms.Platform.iOS
UIDatePicker _picker;
UIColor _defaultTextColor;
+ IElementController ElementController => Element as IElementController;
+
protected override void OnElementChanged(ElementChangedEventArgs<DatePicker> e)
{
base.OnElementChanged(e);
@@ -93,18 +95,17 @@ namespace Xamarin.Forms.Platform.iOS
void HandleValueChanged(object sender, EventArgs e)
{
- if (Element != null)
- ((IElementController)Element).SetValueFromRenderer(DatePicker.DateProperty, _picker.Date.ToDateTime().Date);
+ ElementController?.SetValueFromRenderer(DatePicker.DateProperty, _picker.Date.ToDateTime().Date);
}
void OnEnded(object sender, EventArgs eventArgs)
{
- ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
+ ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
}
void OnStarted(object sender, EventArgs eventArgs)
{
- ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
+ ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
}
void UpdateDateFromModel(bool animate)
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs
index 4d5a3f9..939a984 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs
@@ -23,6 +23,8 @@ namespace Xamarin.Forms.Platform.iOS
{
UIToolbar _accessoryView;
+ IElementController ElementController => Element as IElementController;
+
public override SizeRequest GetDesiredSize(double widthConstraint, double heightConstraint)
{
if (!Forms.IsiOS7OrNewer)
@@ -106,7 +108,7 @@ namespace Xamarin.Forms.Platform.iOS
void HandleChanged(object sender, EventArgs e)
{
- ((IElementController)Element).SetValueFromRenderer(Editor.TextProperty, Control.Text);
+ ElementController.SetValueFromRenderer(Editor.TextProperty, Control.Text);
}
void OnEnded(object sender, EventArgs eventArgs)
@@ -117,7 +119,7 @@ namespace Xamarin.Forms.Platform.iOS
void OnStarted(object sender, EventArgs eventArgs)
{
- ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
+ ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
}
void UpdateEditable()
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs
index 2e8908a..f946de8 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs
@@ -20,6 +20,8 @@ namespace Xamarin.Forms.Platform.iOS
Frame = new RectangleF(0, 20, 320, 40);
}
+ IElementController ElementController => Element as IElementController;
+
protected override void Dispose(bool disposing)
{
if (disposing)
@@ -99,17 +101,17 @@ namespace Xamarin.Forms.Platform.iOS
void OnEditingBegan(object sender, EventArgs e)
{
- ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
+ ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
}
void OnEditingChanged(object sender, EventArgs eventArgs)
{
- ((IElementController)Element).SetValueFromRenderer(Entry.TextProperty, Control.Text);
+ ElementController.SetValueFromRenderer(Entry.TextProperty, Control.Text);
}
void OnEditingEnded(object sender, EventArgs e)
{
- ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
+ ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
}
bool OnShouldReturn(UITextField view)
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs
index 37ae8d2..a08365e 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs
@@ -45,6 +45,8 @@ namespace Xamarin.Forms.Platform.iOS
{
bool _isDisposed;
+ IElementController ElementController => Element as IElementController;
+
protected override void Dispose(bool disposing)
{
if (_isDisposed)
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs
index 5fb69c0..be069e9 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs
@@ -52,6 +52,8 @@ namespace Xamarin.Forms.Platform.iOS
Page Current { get; set; }
+ IPageController PageController => Element as IPageController;
+
public VisualElement Element { get; private set; }
public event EventHandler<VisualElementChangedEventArgs> ElementChanged;
@@ -143,7 +145,7 @@ namespace Xamarin.Forms.Platform.iOS
if (!_appeared)
{
_appeared = true;
- ((NavigationPage)Element)?.SendAppearing();
+ PageController?.SendAppearing();
}
base.ViewDidAppear(animated);
@@ -159,7 +161,7 @@ namespace Xamarin.Forms.Platform.iOS
return;
_appeared = false;
- ((NavigationPage)Element).SendDisappearing();
+ PageController.SendDisappearing();
}
public override void ViewDidLayoutSubviews()
@@ -176,7 +178,7 @@ namespace Xamarin.Forms.Platform.iOS
double trueBottom = toolbar.Hidden ? toolbarY : toolbar.Frame.Bottom;
var modelSize = _queuedSize.IsZero ? Element.Bounds.Size : _queuedSize;
- ((NavigationPage)Element).ContainerArea =
+ PageController.ContainerArea =
new Rectangle(0, toolbar.Hidden ? 0 : toolbar.Frame.Height, modelSize.Width, modelSize.Height - trueBottom);
if (!_queuedSize.IsZero)
@@ -275,7 +277,7 @@ namespace Xamarin.Forms.Platform.iOS
base.Dispose(disposing);
if (_appeared)
{
- ((Page)Element).SendDisappearing();
+ PageController.SendDisappearing();
_appeared = false;
}
@@ -850,7 +852,7 @@ namespace Xamarin.Forms.Platform.iOS
{
if (disposing)
{
- Child.SendDisappearing();
+ ((IPageController)Child).SendDisappearing();
Child = null;
_tracker.Target = null;
_tracker.CollectionChanged -= TrackerOnCollectionChanged;
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs
index 6db3fb6..ff28653 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs
@@ -19,6 +19,8 @@ namespace Xamarin.Forms.Platform.iOS
VisualElementPackager _packager;
VisualElementTracker _tracker;
+ IPageController PageController => Element as IPageController;
+
public PageRenderer()
{
if (!Forms.IsiOS7OrNewer)
@@ -78,7 +80,7 @@ namespace Xamarin.Forms.Platform.iOS
return;
_appeared = true;
- ((Page)Element).SendAppearing();
+ PageController.SendAppearing();
}
public override void ViewDidDisappear(bool animated)
@@ -89,7 +91,7 @@ namespace Xamarin.Forms.Platform.iOS
return;
_appeared = false;
- ((Page)Element).SendDisappearing();
+ PageController.SendDisappearing();
}
public override void ViewDidLoad()
@@ -132,7 +134,7 @@ namespace Xamarin.Forms.Platform.iOS
Element.PropertyChanged -= OnHandlePropertyChanged;
Platform.SetRenderer(Element, null);
if (_appeared)
- ((Page)Element).SendDisappearing();
+ PageController.SendDisappearing();
_appeared = false;
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs
index e4c7352..55ed961 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs
@@ -37,6 +37,8 @@ namespace Xamarin.Forms.Platform.iOS
VisualElementTracker _tracker;
+ IPageController PageController => Element as IPageController;
+
public PhoneMasterDetailRenderer()
{
if (!Forms.IsiOS7OrNewer)
@@ -112,13 +114,13 @@ namespace Xamarin.Forms.Platform.iOS
public override void ViewDidAppear(bool animated)
{
base.ViewDidAppear(animated);
- ((Page)Element).SendAppearing();
+ PageController.SendAppearing();
}
public override void ViewDidDisappear(bool animated)
{
base.ViewDidDisappear(animated);
- ((Page)Element).SendDisappearing();
+ PageController.SendDisappearing();
}
public override void ViewDidLayoutSubviews()
@@ -198,7 +200,7 @@ namespace Xamarin.Forms.Platform.iOS
EmptyContainers();
- ((Page)Element).SendDisappearing();
+ PageController.SendDisappearing();
_disposed = true;
}
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/PickerRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/PickerRenderer.cs
index 7b5461e..bebf91c 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/PickerRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/PickerRenderer.cs
@@ -24,6 +24,8 @@ namespace Xamarin.Forms.Platform.iOS
UIPickerView _picker;
UIColor _defaultTextColor;
+ IElementController ElementController => Element as IElementController;
+
protected override void OnElementChanged(ElementChangedEventArgs<Picker> e)
{
if (e.OldElement != null)
@@ -86,12 +88,12 @@ namespace Xamarin.Forms.Platform.iOS
void OnEnded(object sender, EventArgs eventArgs)
{
- ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
+ ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
}
void OnStarted(object sender, EventArgs eventArgs)
{
- ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
+ ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
}
void RowsCollectionChanged(object sender, EventArgs e)
@@ -119,7 +121,7 @@ namespace Xamarin.Forms.Platform.iOS
if (Element != null)
{
var oldText = Control.Text;
- ((IElementController)Element).SetValueFromRenderer(Picker.SelectedIndexProperty, s.SelectedIndex);
+ ElementController.SetValueFromRenderer(Picker.SelectedIndexProperty, s.SelectedIndex);
Control.Text = s.SelectedItem;
UpdatePickerNativeSize(oldText);
}
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs
index a7e37c9..90a2437 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs
@@ -20,6 +20,8 @@ namespace Xamarin.Forms.Platform.iOS
UIColor _defaultTintColor;
UITextField _textField;
+ IElementController ElementController => Element as IElementController;
+
protected override void Dispose(bool disposing)
{
if (disposing)
@@ -130,20 +132,18 @@ namespace Xamarin.Forms.Platform.iOS
void OnCancelClicked(object sender, EventArgs args)
{
- ((IElementController)Element).SetValueFromRenderer(SearchBar.TextProperty, null);
+ ElementController.SetValueFromRenderer(SearchBar.TextProperty, null);
Control.ResignFirstResponder();
}
void OnEditingEnded(object sender, EventArgs e)
{
- if (Element != null)
- ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
+ ElementController?.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
}
void OnEditingStarted(object sender, EventArgs e)
{
- if (Element != null)
- ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
+ ElementController?.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
}
void OnSearchButtonClicked(object sender, EventArgs e)
@@ -154,7 +154,7 @@ namespace Xamarin.Forms.Platform.iOS
void OnTextChanged(object sender, UISearchBarTextChangedEventArgs a)
{
- ((IElementController)Element).SetValueFromRenderer(SearchBar.TextProperty, Control.Text);
+ ElementController.SetValueFromRenderer(SearchBar.TextProperty, Control.Text);
}
void UpdateAlignment()
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs
index 2db8ac2..4ec1696 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs
@@ -26,6 +26,9 @@ namespace Xamarin.Forms.Platform.iOS
bool _loaded;
Size _queuedSize;
+ IPageController PageController => Element as IPageController;
+ IElementController ElementController => Element as IElementController;
+
public override UIViewController SelectedViewController
{
get { return base.SelectedViewController; }
@@ -102,14 +105,14 @@ namespace Xamarin.Forms.Platform.iOS
public override void ViewDidAppear(bool animated)
{
- ((TabbedPage)Element).SendAppearing();
+ PageController.SendAppearing();
base.ViewDidAppear(animated);
}
public override void ViewDidDisappear(bool animated)
{
base.ViewDidDisappear(animated);
- ((TabbedPage)Element).SendDisappearing();
+ PageController.SendDisappearing();
}
public override void ViewDidLayoutSubviews()
@@ -126,7 +129,7 @@ namespace Xamarin.Forms.Platform.iOS
var frame = View.Frame;
var tabBarFrame = TabBar.Frame;
- ((TabbedPage)Element).ContainerArea = new Rectangle(0, 0, frame.Width, frame.Height - tabBarFrame.Height);
+ PageController.ContainerArea = new Rectangle(0, 0, frame.Width, frame.Height - tabBarFrame.Height);
if (!_queuedSize.IsZero)
{
@@ -149,7 +152,7 @@ namespace Xamarin.Forms.Platform.iOS
{
if (disposing)
{
- ((TabbedPage)Element).SendDisappearing();
+ PageController.SendDisappearing();
Tabbed.PropertyChanged -= OnPropertyChanged;
Tabbed.PagesChanged -= OnPagesChanged;
FinishedCustomizingViewControllers -= HandleFinishedCustomizingViewControllers;
@@ -258,9 +261,9 @@ namespace Xamarin.Forms.Platform.iOS
void SetControllers()
{
var list = new List<UIViewController>();
- for (var i = 0; i < Element.LogicalChildren.Count; i++)
+ for (var i = 0; i < ElementController.LogicalChildren.Count; i++)
{
- var child = Element.LogicalChildren[i];
+ var child = ElementController.LogicalChildren[i];
var v = child as VisualElement;
if (v == null)
continue;
@@ -352,7 +355,7 @@ namespace Xamarin.Forms.Platform.iOS
var originalIndex = -1;
if (int.TryParse(viewControllers[i].TabBarItem.Tag.ToString(), out originalIndex))
{
- var page = (Page)Tabbed.InternalChildren[originalIndex];
+ var page = (TabbedPage)((IPageController)Tabbed).InternalChildren[originalIndex];
TabbedPage.SetIndex(page, i);
}
}
@@ -360,7 +363,8 @@ namespace Xamarin.Forms.Platform.iOS
void UpdateCurrentPage()
{
- ((TabbedPage)Element).CurrentPage = SelectedIndex >= 0 && SelectedIndex < Tabbed.InternalChildren.Count ? Tabbed.GetPageByIndex((int)SelectedIndex) : null;
+ var count = ((IPageController)Tabbed).InternalChildren.Count;
+ ((TabbedPage)Element).CurrentPage = SelectedIndex >= 0 && SelectedIndex < count ? Tabbed.GetPageByIndex((int)SelectedIndex) : null;
}
void IEffectControlProvider.RegisterEffect(Effect effect)
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs
index e49ed5a..cb76b76 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs
@@ -59,6 +59,9 @@ namespace Xamarin.Forms.Platform.iOS
VisualElementTracker _tracker;
+ IPageController PageController => Element as IPageController;
+ IElementController ElementController => Element as IElementController;
+
protected MasterDetailPage MasterDetailPage
{
get { return _masterDetailPage ?? (_masterDetailPage = (MasterDetailPage)Element); }
@@ -77,7 +80,7 @@ namespace Xamarin.Forms.Platform.iOS
{
if (Element != null)
{
- ((Page)Element).SendDisappearing();
+ PageController.SendDisappearing();
Element.PropertyChanged -= HandlePropertyChanged;
Element = null;
}
@@ -155,7 +158,7 @@ namespace Xamarin.Forms.Platform.iOS
public override void ViewDidAppear(bool animated)
{
- ((Page)Element).SendAppearing();
+ PageController.SendAppearing();
base.ViewDidAppear(animated);
ToggleMaster();
}
@@ -163,7 +166,7 @@ namespace Xamarin.Forms.Platform.iOS
public override void ViewDidDisappear(bool animated)
{
base.ViewDidDisappear(animated);
- ((Page)Element).SendDisappearing();
+ PageController.SendDisappearing();
}
public override void ViewDidLayoutSubviews()
@@ -277,14 +280,14 @@ namespace Xamarin.Forms.Platform.iOS
{
_masterVisible = true;
if (MasterDetailPageController.CanChangeIsPresented)
- ((IElementController)Element).SetValueFromRenderer(MasterDetailPage.IsPresentedProperty, true);
+ ElementController.SetValueFromRenderer(MasterDetailPage.IsPresentedProperty, true);
}
void MasterControllerWillDisappear(object sender, EventArgs e)
{
_masterVisible = false;
if (MasterDetailPageController.CanChangeIsPresented)
- ((IElementController)Element).SetValueFromRenderer(MasterDetailPage.IsPresentedProperty, false);
+ ElementController.SetValueFromRenderer(MasterDetailPage.IsPresentedProperty, false);
}
void PerformButtonSelector()
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/TimePickerRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/TimePickerRenderer.cs
index 55dbf1c..f852980 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/TimePickerRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/TimePickerRenderer.cs
@@ -26,6 +26,8 @@ namespace Xamarin.Forms.Platform.iOS
UIDatePicker _picker;
UIColor _defaultTextColor;
+ IElementController ElementController => Element as IElementController;
+
protected override void Dispose(bool disposing)
{
if (disposing)
@@ -89,17 +91,17 @@ namespace Xamarin.Forms.Platform.iOS
void OnEnded(object sender, EventArgs eventArgs)
{
- ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
+ ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
}
void OnStarted(object sender, EventArgs eventArgs)
{
- ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
+ ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
}
void OnValueChanged(object sender, EventArgs e)
{
- ((IElementController)Element).SetValueFromRenderer(TimePicker.TimeProperty, _picker.Date.ToDateTime() - new DateTime(1, 1, 1));
+ ElementController.SetValueFromRenderer(TimePicker.TimeProperty, _picker.Date.ToDateTime() - new DateTime(1, 1, 1));
}
void UpdateTextColor()
diff --git a/Xamarin.Forms.Platform.iOS/VisualElementPackager.cs b/Xamarin.Forms.Platform.iOS/VisualElementPackager.cs
index 7f511d9..0aefc48 100644
--- a/Xamarin.Forms.Platform.iOS/VisualElementPackager.cs
+++ b/Xamarin.Forms.Platform.iOS/VisualElementPackager.cs
@@ -14,6 +14,8 @@ namespace Xamarin.Forms.Platform.iOS
bool _isDisposed;
+ IElementController ElementController => Renderer.Element as IElementController;
+
public VisualElementPackager(IVisualElementRenderer renderer)
{
if (renderer == null)
@@ -33,9 +35,9 @@ namespace Xamarin.Forms.Platform.iOS
public void Load()
{
- for (var i = 0; i < Renderer.Element.LogicalChildren.Count; i++)
+ for (var i = 0; i < ElementController.LogicalChildren.Count; i++)
{
- var child = Renderer.Element.LogicalChildren[i] as VisualElement;
+ var child = ElementController.LogicalChildren[i] as VisualElement;
if (child != null)
OnChildAdded(child);
}
@@ -90,12 +92,12 @@ namespace Xamarin.Forms.Platform.iOS
void EnsureChildrenOrder()
{
- if (Renderer.Element.LogicalChildren.Count == 0)
+ if (ElementController.LogicalChildren.Count == 0)
return;
- for (var z = 0; z < Renderer.Element.LogicalChildren.Count; z++)
+ for (var z = 0; z < ElementController.LogicalChildren.Count; z++)
{
- var child = Renderer.Element.LogicalChildren[z] as VisualElement;
+ var child = ElementController.LogicalChildren[z] as VisualElement;
if (child == null)
continue;
var childRenderer = Platform.GetRenderer(child);
@@ -152,9 +154,11 @@ namespace Xamarin.Forms.Platform.iOS
}
else
{
- for (var i = 0; i < oldElement.LogicalChildren.Count; i++)
+ var elementController = ((IElementController)oldElement);
+
+ for (var i = 0; i < elementController.LogicalChildren.Count; i++)
{
- var child = oldElement.LogicalChildren[i] as VisualElement;
+ var child = elementController.LogicalChildren[i] as VisualElement;
if (child != null)
OnChildRemoved(child);
}
diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/Element.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/Element.xml
index 917a24e..0626721 100644
--- a/docs/Xamarin.Forms.Core/Xamarin.Forms/Element.xml
+++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/Element.xml
@@ -625,6 +625,22 @@
<remarks>To be added.</remarks>
</Docs>
</Member>
+ <Member MemberName="Xamarin.Forms.IElementController.LogicalChildren">
+ <MemberSignature Language="C#" Value="System.Collections.ObjectModel.ReadOnlyCollection&lt;Xamarin.Forms.Element&gt; Xamarin.Forms.IElementController.LogicalChildren { get; }" />
+ <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.ObjectModel.ReadOnlyCollection`1&lt;class Xamarin.Forms.Element&gt; Xamarin.Forms.IElementController.LogicalChildren" />
+ <MemberType>Property</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.Collections.ObjectModel.ReadOnlyCollection&lt;Xamarin.Forms.Element&gt;</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <value>To be added.</value>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
<Member MemberName="Xamarin.Forms.IElementController.SetValueFromRenderer">
<MemberSignature Language="C#" Value="void IElementController.SetValueFromRenderer (Xamarin.Forms.BindableProperty property, object value);" />
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void Xamarin.Forms.IElementController.SetValueFromRenderer(class Xamarin.Forms.BindableProperty property, object value) cil managed" />
diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/IElementController.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/IElementController.xml
index af57007..d891eb0 100644
--- a/docs/Xamarin.Forms.Core/Xamarin.Forms/IElementController.xml
+++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/IElementController.xml
@@ -30,6 +30,22 @@
<remarks>To be added.</remarks>
</Docs>
</Member>
+ <Member MemberName="LogicalChildren">
+ <MemberSignature Language="C#" Value="public System.Collections.ObjectModel.ReadOnlyCollection&lt;Xamarin.Forms.Element&gt; LogicalChildren { get; }" />
+ <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.ObjectModel.ReadOnlyCollection`1&lt;class Xamarin.Forms.Element&gt; LogicalChildren" />
+ <MemberType>Property</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.Collections.ObjectModel.ReadOnlyCollection&lt;Xamarin.Forms.Element&gt;</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <value>To be added.</value>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
<Member MemberName="SetValueFromRenderer">
<MemberSignature Language="C#" Value="public void SetValueFromRenderer (Xamarin.Forms.BindableProperty property, object value);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void SetValueFromRenderer(class Xamarin.Forms.BindableProperty property, object value) cil managed" />
diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/IPageController.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/IPageController.xml
new file mode 100644
index 0000000..400f038
--- /dev/null
+++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/IPageController.xml
@@ -0,0 +1,95 @@
+<Type Name="IPageController" FullName="Xamarin.Forms.IPageController">
+ <TypeSignature Language="C#" Value="public interface IPageController" />
+ <TypeSignature Language="ILAsm" Value=".class public interface auto ansi abstract IPageController" />
+ <AssemblyInfo>
+ <AssemblyName>Xamarin.Forms.Core</AssemblyName>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <Interfaces />
+ <Docs>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+ <Members>
+ <Member MemberName="ContainerArea">
+ <MemberSignature Language="C#" Value="public Xamarin.Forms.Rectangle ContainerArea { get; set; }" />
+ <MemberSignature Language="ILAsm" Value=".property instance valuetype Xamarin.Forms.Rectangle ContainerArea" />
+ <MemberType>Property</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>Xamarin.Forms.Rectangle</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <value>To be added.</value>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="IgnoresContainerArea">
+ <MemberSignature Language="C#" Value="public bool IgnoresContainerArea { get; set; }" />
+ <MemberSignature Language="ILAsm" Value=".property instance bool IgnoresContainerArea" />
+ <MemberType>Property</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.Boolean</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <value>To be added.</value>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="InternalChildren">
+ <MemberSignature Language="C#" Value="public System.Collections.ObjectModel.ObservableCollection&lt;Xamarin.Forms.Element&gt; InternalChildren { get; }" />
+ <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.ObjectModel.ObservableCollection`1&lt;class Xamarin.Forms.Element&gt; InternalChildren" />
+ <MemberType>Property</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.Collections.ObjectModel.ObservableCollection&lt;Xamarin.Forms.Element&gt;</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <value>To be added.</value>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="SendAppearing">
+ <MemberSignature Language="C#" Value="public void SendAppearing ();" />
+ <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void SendAppearing() cil managed" />
+ <MemberType>Method</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.Void</ReturnType>
+ </ReturnValue>
+ <Parameters />
+ <Docs>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="SendDisappearing">
+ <MemberSignature Language="C#" Value="public void SendDisappearing ();" />
+ <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void SendDisappearing() cil managed" />
+ <MemberType>Method</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.Void</ReturnType>
+ </ReturnValue>
+ <Parameters />
+ <Docs>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ </Members>
+</Type>
diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/Page.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/Page.xml
index 386d81d..ba4fd76 100644
--- a/docs/Xamarin.Forms.Core/Xamarin.Forms/Page.xml
+++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/Page.xml
@@ -1,6 +1,6 @@
<Type Name="Page" FullName="Xamarin.Forms.Page">
- <TypeSignature Language="C#" Value="public class Page : Xamarin.Forms.VisualElement, Xamarin.Forms.ILayout" />
- <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit Page extends Xamarin.Forms.VisualElement implements class Xamarin.Forms.ILayout" />
+ <TypeSignature Language="C#" Value="public class Page : Xamarin.Forms.VisualElement, Xamarin.Forms.ILayout, Xamarin.Forms.IPageController" />
+ <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit Page extends Xamarin.Forms.VisualElement implements class Xamarin.Forms.ILayout, class Xamarin.Forms.IPageController" />
<AssemblyInfo>
<AssemblyName>Xamarin.Forms.Core</AssemblyName>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
@@ -18,6 +18,9 @@
<Interface>
<InterfaceName>Xamarin.Forms.ILayout</InterfaceName>
</Interface>
+ <Interface>
+ <InterfaceName>Xamarin.Forms.IPageController</InterfaceName>
+ </Interface>
</Interfaces>
<Attributes>
<Attribute>
@@ -212,6 +215,36 @@ namespace MyFirstFormsApp.WinPhone
<remarks>To be added.</remarks>
</Docs>
</Member>
+ <Member MemberName="ActionSheetSignalName">
+ <MemberSignature Language="C#" Value="public const string ActionSheetSignalName;" />
+ <MemberSignature Language="ILAsm" Value=".field public static literal string ActionSheetSignalName" />
+ <MemberType>Field</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.String</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="AlertSignalName">
+ <MemberSignature Language="C#" Value="public const string AlertSignalName;" />
+ <MemberSignature Language="ILAsm" Value=".field public static literal string AlertSignalName" />
+ <MemberType>Field</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.String</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
<Member MemberName="Appearing">
<MemberSignature Language="C#" Value="public event EventHandler Appearing;" />
<MemberSignature Language="ILAsm" Value=".event class System.EventHandler Appearing" />
@@ -276,6 +309,21 @@ namespace MyFirstFormsApp.WinPhone
<remarks>To be added.</remarks>
</Docs>
</Member>
+ <Member MemberName="BusySetSignalName">
+ <MemberSignature Language="C#" Value="public const string BusySetSignalName;" />
+ <MemberSignature Language="ILAsm" Value=".field public static literal string BusySetSignalName" />
+ <MemberType>Field</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.String</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
<Member MemberName="Disappearing">
<MemberSignature Language="C#" Value="public event EventHandler Disappearing;" />
<MemberSignature Language="ILAsm" Value=".event class System.EventHandler Disappearing" />
@@ -871,5 +919,85 @@ namespace MyFirstFormsApp.WinPhone
<remarks>To be added.</remarks>
</Docs>
</Member>
+ <Member MemberName="Xamarin.Forms.IPageController.ContainerArea">
+ <MemberSignature Language="C#" Value="Xamarin.Forms.Rectangle Xamarin.Forms.IPageController.ContainerArea { get; set; }" />
+ <MemberSignature Language="ILAsm" Value=".property instance valuetype Xamarin.Forms.Rectangle Xamarin.Forms.IPageController.ContainerArea" />
+ <MemberType>Property</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>Xamarin.Forms.Rectangle</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <value>To be added.</value>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="Xamarin.Forms.IPageController.IgnoresContainerArea">
+ <MemberSignature Language="C#" Value="bool Xamarin.Forms.IPageController.IgnoresContainerArea { get; set; }" />
+ <MemberSignature Language="ILAsm" Value=".property instance bool Xamarin.Forms.IPageController.IgnoresContainerArea" />
+ <MemberType>Property</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.Boolean</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <value>To be added.</value>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="Xamarin.Forms.IPageController.InternalChildren">
+ <MemberSignature Language="C#" Value="System.Collections.ObjectModel.ObservableCollection&lt;Xamarin.Forms.Element&gt; Xamarin.Forms.IPageController.InternalChildren { get; }" />
+ <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.ObjectModel.ObservableCollection`1&lt;class Xamarin.Forms.Element&gt; Xamarin.Forms.IPageController.InternalChildren" />
+ <MemberType>Property</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.Collections.ObjectModel.ObservableCollection&lt;Xamarin.Forms.Element&gt;</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <value>To be added.</value>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="Xamarin.Forms.IPageController.SendAppearing">
+ <MemberSignature Language="C#" Value="void IPageController.SendAppearing ();" />
+ <MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void Xamarin.Forms.IPageController.SendAppearing() cil managed" />
+ <MemberType>Method</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.Void</ReturnType>
+ </ReturnValue>
+ <Parameters />
+ <Docs>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="Xamarin.Forms.IPageController.SendDisappearing">
+ <MemberSignature Language="C#" Value="void IPageController.SendDisappearing ();" />
+ <MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void Xamarin.Forms.IPageController.SendDisappearing() cil managed" />
+ <MemberType>Method</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.Void</ReturnType>
+ </ReturnValue>
+ <Parameters />
+ <Docs>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
</Members>
</Type>