summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core
diff options
context:
space:
mode:
authorE.Z. Hart <hartez@users.noreply.github.com>2016-06-16 09:45:09 -0600
committerRui Marinho <me@ruimarinho.net>2016-06-16 16:45:09 +0100
commitd5be2f0144ca810fdfbf59808d526c26fe86017e (patch)
tree3ad7e4465307cd6d633184e05d85eb3a4df59e01 /Xamarin.Forms.Core
parent04f7bd296ee67af9189ecd7fdfbd2808ca16ce9a (diff)
downloadxamarin-forms-d5be2f0144ca810fdfbf59808d526c26fe86017e.tar.gz
xamarin-forms-d5be2f0144ca810fdfbf59808d526c26fe86017e.tar.bz2
xamarin-forms-d5be2f0144ca810fdfbf59808d526c26fe86017e.zip
Prep Page for removal of InternalsVisibleTo (#150)
Diffstat (limited to 'Xamarin.Forms.Core')
-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
18 files changed, 121 insertions, 94 deletions
diff --git a/Xamarin.Forms.Core/AbsoluteLayout.cs b/Xamarin.Forms.Core/AbsoluteLayout.cs
index aceec2b3..43924831 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 230b744b..4b5a91af 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 334822f6..1ed35c9d 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 a99a048b..5dce2145 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 b6312737..3bfa5cd6 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 4e1ab10d..41f229c4 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 00000000..298cffc9
--- /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 a98e46a1..8c0d1625 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 6885ecef..61cc42db 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 89fd7e9c..a738249d 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 b13fc6c4..85c8ac89 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 2e1caf0f..7c21a3b9 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 e115a23d..aa807979 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 a965308c..4a8d21b9 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 69c2d58b..aa811510 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 30dadb92..89543f2d 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 da8b8292..d8bcd3d4 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 1c11517a..55b60bbc 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" />