summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core
diff options
context:
space:
mode:
authorSamantha Houts <samantha@teamredwall.com>2016-06-17 03:10:18 -0700
committerRui Marinho <me@ruimarinho.net>2016-06-17 11:10:18 +0100
commit925fc0aa588a060eb23fa16c1d225dd030012c23 (patch)
tree83676c25c29d97d9250516b217020ba85425796d /Xamarin.Forms.Core
parentd44396a4534b1e2bc81143c809e4adaee656ab15 (diff)
downloadxamarin-forms-925fc0aa588a060eb23fa16c1d225dd030012c23.tar.gz
xamarin-forms-925fc0aa588a060eb23fa16c1d225dd030012c23.tar.bz2
xamarin-forms-925fc0aa588a060eb23fa16c1d225dd030012c23.zip
Prep Cell & friends for removal of InternalsVisibleTo (#142)
* Prep Cell & friends for removal of InternalsVisibleTo Includes: - Cell - EntryCell - ListView - MenuItem - TableView - ViewCell - Toolbar Moved extensions to Internal & removed TPH * Update docs * [Controls] Ignore Issue2411 on iOS <9 * [Controls] Formatting for Issue2411
Diffstat (limited to 'Xamarin.Forms.Core')
-rw-r--r--Xamarin.Forms.Core/Cells/Cell.cs15
-rw-r--r--Xamarin.Forms.Core/Cells/EntryCell.cs4
-rw-r--r--Xamarin.Forms.Core/Cells/ICellController.cs15
-rw-r--r--Xamarin.Forms.Core/Cells/IEntryCellController.cs8
-rw-r--r--Xamarin.Forms.Core/IItemsView.cs5
-rw-r--r--Xamarin.Forms.Core/IListProxy.cs12
-rw-r--r--Xamarin.Forms.Core/IListViewController.cs15
-rw-r--r--Xamarin.Forms.Core/IMenuItemController.cs10
-rw-r--r--Xamarin.Forms.Core/ITableModel.cs16
-rw-r--r--Xamarin.Forms.Core/ITableViewController.cs11
-rw-r--r--Xamarin.Forms.Core/ITemplatedItemsList.cs30
-rw-r--r--Xamarin.Forms.Core/ITemplatedItemsListScrollToRequestedEventArgs.cs13
-rw-r--r--Xamarin.Forms.Core/ITemplatedItemsView.cs12
-rw-r--r--Xamarin.Forms.Core/Internals/CellExtensions.cs38
-rw-r--r--Xamarin.Forms.Core/Internals/NotifyCollectionChangedEventArgsEx.cs (renamed from Xamarin.Forms.Core/NotifyCollectionChangedEventArgsEx.cs)4
-rw-r--r--Xamarin.Forms.Core/Internals/NotifyCollectionChangedEventArgsExtensions.cs (renamed from Xamarin.Forms.Core/NotifyCollectionChangedEventArgsExtensions.cs)4
-rw-r--r--Xamarin.Forms.Core/Internals/ToolbarTracker.cs (renamed from Xamarin.Forms.Core/ToolbarTracker.cs)4
-rw-r--r--Xamarin.Forms.Core/ItemsView.cs8
-rw-r--r--Xamarin.Forms.Core/ListProxy.cs3
-rw-r--r--Xamarin.Forms.Core/ListView.cs45
-rw-r--r--Xamarin.Forms.Core/MenuItem.cs20
-rw-r--r--Xamarin.Forms.Core/ScrollToRequestedEventArgs.cs17
-rw-r--r--Xamarin.Forms.Core/TableModel.cs2
-rw-r--r--Xamarin.Forms.Core/TableView.cs15
-rw-r--r--Xamarin.Forms.Core/TemplatedItemsList.cs45
-rw-r--r--Xamarin.Forms.Core/Xamarin.Forms.Core.csproj24
26 files changed, 351 insertions, 44 deletions
diff --git a/Xamarin.Forms.Core/Cells/Cell.cs b/Xamarin.Forms.Core/Cells/Cell.cs
index 3b16d06a..863e0342 100644
--- a/Xamarin.Forms.Core/Cells/Cell.cs
+++ b/Xamarin.Forms.Core/Cells/Cell.cs
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace Xamarin.Forms
{
- public abstract class Cell : Element
+ public abstract class Cell : Element, ICellController
{
public static readonly BindableProperty IsEnabledProperty = BindableProperty.Create("IsEnabled", typeof(bool), typeof(Cell), true, propertyChanged: OnIsEnabledPropertyChanged);
@@ -78,6 +78,13 @@ namespace Xamarin.Forms
public event EventHandler Disappearing;
+ event EventHandler ForceUpdateSizeRequested;
+ event EventHandler ICellController.ForceUpdateSizeRequested
+ {
+ add { ForceUpdateSizeRequested += value; }
+ remove { ForceUpdateSizeRequested -= value; }
+ }
+
public void ForceUpdateSize()
{
if (_nextCallToForceUpdateSizeQueued)
@@ -148,9 +155,7 @@ namespace Xamarin.Forms
base.OnPropertyChanging(propertyName);
}
- internal event EventHandler ForceUpdateSizeRequested;
-
- internal void SendAppearing()
+ void ICellController.SendAppearing()
{
OnAppearing();
@@ -159,7 +164,7 @@ namespace Xamarin.Forms
container.SendCellAppearing(this);
}
- internal void SendDisappearing()
+ void ICellController.SendDisappearing()
{
OnDisappearing();
diff --git a/Xamarin.Forms.Core/Cells/EntryCell.cs b/Xamarin.Forms.Core/Cells/EntryCell.cs
index cccdcae1..b61f685f 100644
--- a/Xamarin.Forms.Core/Cells/EntryCell.cs
+++ b/Xamarin.Forms.Core/Cells/EntryCell.cs
@@ -2,7 +2,7 @@ using System;
namespace Xamarin.Forms
{
- public class EntryCell : Cell
+ public class EntryCell : Cell, IEntryCellController
{
public static readonly BindableProperty TextProperty = BindableProperty.Create("Text", typeof(string), typeof(EntryCell), null, BindingMode.TwoWay);
@@ -64,7 +64,7 @@ namespace Xamarin.Forms
public event EventHandler Completed;
- internal void SendCompleted()
+ void IEntryCellController.SendCompleted()
{
EventHandler handler = Completed;
if (handler != null)
diff --git a/Xamarin.Forms.Core/Cells/ICellController.cs b/Xamarin.Forms.Core/Cells/ICellController.cs
new file mode 100644
index 00000000..ab5d08c2
--- /dev/null
+++ b/Xamarin.Forms.Core/Cells/ICellController.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Xamarin.Forms
+{
+ public interface ICellController
+ {
+ event EventHandler ForceUpdateSizeRequested;
+
+ void SendAppearing();
+ void SendDisappearing();
+ }
+}
diff --git a/Xamarin.Forms.Core/Cells/IEntryCellController.cs b/Xamarin.Forms.Core/Cells/IEntryCellController.cs
new file mode 100644
index 00000000..b3722d67
--- /dev/null
+++ b/Xamarin.Forms.Core/Cells/IEntryCellController.cs
@@ -0,0 +1,8 @@
+
+namespace Xamarin.Forms
+{
+ public interface IEntryCellController
+ {
+ void SendCompleted();
+ }
+}
diff --git a/Xamarin.Forms.Core/IItemsView.cs b/Xamarin.Forms.Core/IItemsView.cs
index 7f968769..d2c721ba 100644
--- a/Xamarin.Forms.Core/IItemsView.cs
+++ b/Xamarin.Forms.Core/IItemsView.cs
@@ -1,6 +1,9 @@
+using System;
+using System.Collections;
+
namespace Xamarin.Forms
{
- internal interface IItemsView<T> where T : BindableObject
+ public interface IItemsView<T> where T : BindableObject
{
T CreateDefault(object item);
void SetupContent(T content, int index);
diff --git a/Xamarin.Forms.Core/IListProxy.cs b/Xamarin.Forms.Core/IListProxy.cs
new file mode 100644
index 00000000..cc6fd500
--- /dev/null
+++ b/Xamarin.Forms.Core/IListProxy.cs
@@ -0,0 +1,12 @@
+
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace Xamarin.Forms
+{
+ public interface IListProxy : IList
+ {
+ event NotifyCollectionChangedEventHandler CollectionChanged;
+ IEnumerable ProxiedEnumerable { get; }
+ }
+}
diff --git a/Xamarin.Forms.Core/IListViewController.cs b/Xamarin.Forms.Core/IListViewController.cs
index 078f13b7..68c99de9 100644
--- a/Xamarin.Forms.Core/IListViewController.cs
+++ b/Xamarin.Forms.Core/IListViewController.cs
@@ -1,13 +1,20 @@
-namespace Xamarin.Forms
+using System;
+
+namespace Xamarin.Forms
{
- internal interface IListViewController : IViewController
+ public interface IListViewController : IViewController
{
- Element FooterElement { get; }
+ event EventHandler<ScrollToRequestedEventArgs> ScrollToRequested;
+ ListViewCachingStrategy CachingStrategy { get; }
+ Element FooterElement { get; }
Element HeaderElement { get; }
-
bool RefreshAllowed { get; }
+ Cell CreateDefaultCell(object item);
+ string GetDisplayTextFromGroup(object cell);
+ void NotifyRowTapped(int index, int inGroupIndex, Cell cell);
+ void NotifyRowTapped(int index, Cell cell);
void SendCellAppearing(Cell cell);
void SendCellDisappearing(Cell cell);
void SendRefreshing();
diff --git a/Xamarin.Forms.Core/IMenuItemController.cs b/Xamarin.Forms.Core/IMenuItemController.cs
new file mode 100644
index 00000000..4737b170
--- /dev/null
+++ b/Xamarin.Forms.Core/IMenuItemController.cs
@@ -0,0 +1,10 @@
+namespace Xamarin.Forms
+{
+ public interface IMenuItemController
+ {
+ bool IsEnabled { get; }
+ string IsEnabledPropertyName { get; }
+
+ void Activate();
+ }
+}
diff --git a/Xamarin.Forms.Core/ITableModel.cs b/Xamarin.Forms.Core/ITableModel.cs
new file mode 100644
index 00000000..4778b908
--- /dev/null
+++ b/Xamarin.Forms.Core/ITableModel.cs
@@ -0,0 +1,16 @@
+namespace Xamarin.Forms
+{
+ public interface ITableModel
+ {
+ Cell GetCell(int section, int row);
+ Cell GetHeaderCell(int section);
+ object GetItem(int section, int row);
+ int GetRowCount(int section);
+ int GetSectionCount();
+ string[] GetSectionIndexTitles();
+ string GetSectionTitle(int section);
+ void RowLongPressed(int section, int row);
+ void RowSelected(object item);
+ void RowSelected(int section, int row);
+ }
+}
diff --git a/Xamarin.Forms.Core/ITableViewController.cs b/Xamarin.Forms.Core/ITableViewController.cs
new file mode 100644
index 00000000..0f7cb08a
--- /dev/null
+++ b/Xamarin.Forms.Core/ITableViewController.cs
@@ -0,0 +1,11 @@
+using System;
+
+namespace Xamarin.Forms
+{
+ public interface ITableViewController
+ {
+ event EventHandler ModelChanged;
+
+ ITableModel Model { get; }
+ }
+}
diff --git a/Xamarin.Forms.Core/ITemplatedItemsList.cs b/Xamarin.Forms.Core/ITemplatedItemsList.cs
new file mode 100644
index 00000000..ae979d71
--- /dev/null
+++ b/Xamarin.Forms.Core/ITemplatedItemsList.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Collections;
+
+namespace Xamarin.Forms
+{
+ public interface ITemplatedItemsList<TItem> : IReadOnlyList<TItem>, INotifyCollectionChanged where TItem : BindableObject
+ {
+ event NotifyCollectionChangedEventHandler GroupedCollectionChanged;
+ event PropertyChangedEventHandler PropertyChanged;
+
+ object BindingContext { get; }
+ string Name { get; set; }
+ TItem HeaderContent { get; }
+ IEnumerable ItemsSource { get; }
+ IReadOnlyList<string> ShortNames { get; }
+
+ int GetGlobalIndexForGroup(ITemplatedItemsList<TItem> group);
+ int GetGlobalIndexOfItem(object item);
+ ITemplatedItemsList<TItem> GetGroup(int index);
+ Tuple<int, int> GetGroupAndIndexOfItem(object item);
+ Tuple<int, int> GetGroupAndIndexOfItem(object group, object item);
+ int GetGroupIndexFromGlobal(int globalIndex, out int leftOver);
+ int IndexOf(TItem item);
+ TItem UpdateContent(TItem content, int index);
+ TItem UpdateHeader(TItem content, int groupIndex);
+ }
+}
diff --git a/Xamarin.Forms.Core/ITemplatedItemsListScrollToRequestedEventArgs.cs b/Xamarin.Forms.Core/ITemplatedItemsListScrollToRequestedEventArgs.cs
new file mode 100644
index 00000000..4a006157
--- /dev/null
+++ b/Xamarin.Forms.Core/ITemplatedItemsListScrollToRequestedEventArgs.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Xamarin.Forms
+{
+ public interface ITemplatedItemsListScrollToRequestedEventArgs
+ {
+ object Group { get; }
+ object Item { get; }
+ }
+}
diff --git a/Xamarin.Forms.Core/ITemplatedItemsView.cs b/Xamarin.Forms.Core/ITemplatedItemsView.cs
new file mode 100644
index 00000000..01d4e22e
--- /dev/null
+++ b/Xamarin.Forms.Core/ITemplatedItemsView.cs
@@ -0,0 +1,12 @@
+using System.ComponentModel;
+
+namespace Xamarin.Forms
+{
+ public interface ITemplatedItemsView<TItem> : IItemsView<TItem> where TItem : BindableObject
+ {
+ event PropertyChangedEventHandler PropertyChanged;
+
+ IListProxy ListProxy { get; }
+ ITemplatedItemsList<TItem> TemplatedItems { get; }
+ }
+}
diff --git a/Xamarin.Forms.Core/Internals/CellExtensions.cs b/Xamarin.Forms.Core/Internals/CellExtensions.cs
new file mode 100644
index 00000000..f15268b1
--- /dev/null
+++ b/Xamarin.Forms.Core/Internals/CellExtensions.cs
@@ -0,0 +1,38 @@
+using System;
+
+namespace Xamarin.Forms.Internals
+{
+ public static class CellExtensions
+ {
+ public static bool GetIsGroupHeader<TView, TItem>(this TItem cell) where TView : BindableObject, ITemplatedItemsView<TItem> where TItem : BindableObject
+ {
+ return TemplatedItemsList<TView, TItem>.GetIsGroupHeader(cell);
+ }
+
+ public static void SetIsGroupHeader<TView, TItem>(this TItem cell, bool value) where TView : BindableObject, ITemplatedItemsView<TItem> where TItem : BindableObject
+ {
+ TemplatedItemsList<TView, TItem>.SetIsGroupHeader(cell, value);
+ }
+
+ public static TItem GetGroupHeaderContent<TView, TItem>(this TItem cell) where TView : BindableObject, ITemplatedItemsView<TItem> where TItem : BindableObject
+ {
+ var group = TemplatedItemsList<TView, TItem>.GetGroup(cell);
+ return group.HeaderContent;
+ }
+
+ public static int GetIndex<TView, TItem>(this TItem cell) where TView : BindableObject, ITemplatedItemsView<TItem> where TItem : BindableObject
+ {
+ return TemplatedItemsList<TView, TItem>.GetIndex(cell);
+ }
+
+ public static ITemplatedItemsList<TItem> GetGroup<TView, TItem>(this TItem cell) where TView : BindableObject, ITemplatedItemsView<TItem> where TItem : BindableObject
+ {
+ return TemplatedItemsList<TView, TItem>.GetGroup(cell);
+ }
+
+ public static Tuple<int, int> GetPath(this Cell cell)
+ {
+ return TableView.TableSectionModel.GetPath(cell);
+ }
+ }
+}
diff --git a/Xamarin.Forms.Core/NotifyCollectionChangedEventArgsEx.cs b/Xamarin.Forms.Core/Internals/NotifyCollectionChangedEventArgsEx.cs
index bb6a2b84..b398c7d9 100644
--- a/Xamarin.Forms.Core/NotifyCollectionChangedEventArgsEx.cs
+++ b/Xamarin.Forms.Core/Internals/NotifyCollectionChangedEventArgsEx.cs
@@ -1,9 +1,9 @@
using System.Collections;
using System.Collections.Specialized;
-namespace Xamarin.Forms
+namespace Xamarin.Forms.Internals
{
- internal class NotifyCollectionChangedEventArgsEx : NotifyCollectionChangedEventArgs
+ public class NotifyCollectionChangedEventArgsEx : NotifyCollectionChangedEventArgs
{
public NotifyCollectionChangedEventArgsEx(int count, NotifyCollectionChangedAction action) : base(action)
{
diff --git a/Xamarin.Forms.Core/NotifyCollectionChangedEventArgsExtensions.cs b/Xamarin.Forms.Core/Internals/NotifyCollectionChangedEventArgsExtensions.cs
index 2ddf92c4..8b88dc38 100644
--- a/Xamarin.Forms.Core/NotifyCollectionChangedEventArgsExtensions.cs
+++ b/Xamarin.Forms.Core/Internals/NotifyCollectionChangedEventArgsExtensions.cs
@@ -2,9 +2,9 @@
using System.Collections.Generic;
using System.Collections.Specialized;
-namespace Xamarin.Forms
+namespace Xamarin.Forms.Internals
{
- internal static class NotifyCollectionChangedEventArgsExtensions
+ public static class NotifyCollectionChangedEventArgsExtensions
{
public static void Apply<TFrom>(this NotifyCollectionChangedEventArgs self, IList<TFrom> from, IList<object> to)
{
diff --git a/Xamarin.Forms.Core/ToolbarTracker.cs b/Xamarin.Forms.Core/Internals/ToolbarTracker.cs
index 74580065..69f275e8 100644
--- a/Xamarin.Forms.Core/ToolbarTracker.cs
+++ b/Xamarin.Forms.Core/Internals/ToolbarTracker.cs
@@ -5,9 +5,9 @@ using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
-namespace Xamarin.Forms
+namespace Xamarin.Forms.Internals
{
- internal class ToolbarTracker
+ public class ToolbarTracker
{
int _masterDetails;
Page _target;
diff --git a/Xamarin.Forms.Core/ItemsView.cs b/Xamarin.Forms.Core/ItemsView.cs
index 51c105bd..b99fdf03 100644
--- a/Xamarin.Forms.Core/ItemsView.cs
+++ b/Xamarin.Forms.Core/ItemsView.cs
@@ -1,8 +1,10 @@
using System.Collections;
+using Xamarin.Forms.Internals;
namespace Xamarin.Forms
{
- public abstract class ItemsView<TVisual> : View, IItemsView<TVisual> where TVisual : BindableObject
+
+ public abstract class ItemsView<TVisual> : View, ITemplatedItemsView<TVisual> where TVisual : BindableObject
{
/*
public static readonly BindableProperty InfiniteScrollingProperty =
@@ -40,11 +42,13 @@ namespace Xamarin.Forms
this.templatedItems.ForceUpdate();
}*/
- internal ListProxy ListProxy
+ IListProxy ITemplatedItemsView<TVisual>.ListProxy
{
get { return TemplatedItems.ListProxy; }
}
+ ITemplatedItemsList<TVisual> ITemplatedItemsView<TVisual>.TemplatedItems { get { return TemplatedItems; } }
+
internal TemplatedItemsList<ItemsView<TVisual>, TVisual> TemplatedItems { get; }
TVisual IItemsView<TVisual>.CreateDefault(object item)
diff --git a/Xamarin.Forms.Core/ListProxy.cs b/Xamarin.Forms.Core/ListProxy.cs
index 229dcb6b..c2f5c9d8 100644
--- a/Xamarin.Forms.Core/ListProxy.cs
+++ b/Xamarin.Forms.Core/ListProxy.cs
@@ -3,10 +3,11 @@ using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
+using Xamarin.Forms.Internals;
namespace Xamarin.Forms
{
- internal sealed class ListProxy : IReadOnlyList<object>, IList, INotifyCollectionChanged
+ internal sealed class ListProxy : IReadOnlyList<object>, IListProxy, INotifyCollectionChanged
{
readonly ICollection _collection;
readonly IList _list;
diff --git a/Xamarin.Forms.Core/ListView.cs b/Xamarin.Forms.Core/ListView.cs
index 71feea68..deebda7f 100644
--- a/Xamarin.Forms.Core/ListView.cs
+++ b/Xamarin.Forms.Core/ListView.cs
@@ -3,6 +3,7 @@ using System.Collections;
using System.Diagnostics;
using System.Windows.Input;
using Xamarin.Forms.Platform;
+using Xamarin.Forms.Internals;
namespace Xamarin.Forms
{
@@ -59,8 +60,6 @@ namespace Xamarin.Forms
public ListView()
{
- TakePerformanceHit = false;
-
VerticalOptions = HorizontalOptions = LayoutOptions.FillAndExpand;
TemplatedItems.IsGroupingEnabledProperty = IsGroupingEnabledProperty;
@@ -190,8 +189,13 @@ namespace Xamarin.Forms
}
internal ListViewCachingStrategy CachingStrategy { get; private set; }
-
- internal bool TakePerformanceHit { get; set; }
+ ListViewCachingStrategy IListViewController.CachingStrategy
+ {
+ get
+ {
+ return CachingStrategy;
+ }
+ }
bool RefreshAllowed
{
@@ -342,14 +346,32 @@ namespace Xamarin.Forms
content.Parent = null;
}
- internal Cell CreateDefaultCell(object item)
+ Cell IListViewController.CreateDefaultCell(object item)
{
return CreateDefault(item);
}
+ string IListViewController.GetDisplayTextFromGroup(object cell)
+ {
+ int groupIndex = TemplatedItems.GetGlobalIndexOfGroup(cell);
+ var group = TemplatedItems.GetGroup(groupIndex);
+
+ string displayBinding = null;
+
+ if (GroupDisplayBinding != null)
+ displayBinding = group.Name;
+
+ if (GroupShortNameBinding != null)
+ displayBinding = group.ShortName;
+
+ // TODO: what if they set both? should it default to the ShortName, like it will here?
+ // ShortNames binding did not appear to be functional before.
+ return displayBinding;
+ }
+
internal void NotifyRowTapped(int groupIndex, int inGroupIndex, Cell cell = null)
{
- TemplatedItemsList<ItemsView<Cell>, Cell> group = TemplatedItems.GetGroup(groupIndex);
+ var group = TemplatedItems.GetGroup(groupIndex);
bool changed = _previousGroupSelected != groupIndex || _previousRowSelected != inGroupIndex;
@@ -381,6 +403,16 @@ namespace Xamarin.Forms
NotifyRowTapped(0, index, cell);
}
+ void IListViewController.NotifyRowTapped(int index, Cell cell)
+ {
+ NotifyRowTapped(index, cell);
+ }
+
+ void IListViewController.NotifyRowTapped(int index, int inGroupIndex, Cell cell)
+ {
+ NotifyRowTapped(index, inGroupIndex, cell);
+ }
+
internal override void OnIsPlatformEnabledChanged()
{
base.OnIsPlatformEnabledChanged();
@@ -393,6 +425,7 @@ namespace Xamarin.Forms
}
internal event EventHandler<ScrollToRequestedEventArgs> ScrollToRequested;
+ event EventHandler<ScrollToRequestedEventArgs> IListViewController.ScrollToRequested { add { ScrollToRequested += value; } remove { ScrollToRequested -= value; } }
void OnCommandCanExecuteChanged(object sender, EventArgs eventArgs)
{
diff --git a/Xamarin.Forms.Core/MenuItem.cs b/Xamarin.Forms.Core/MenuItem.cs
index 3e830445..84ad0327 100644
--- a/Xamarin.Forms.Core/MenuItem.cs
+++ b/Xamarin.Forms.Core/MenuItem.cs
@@ -3,7 +3,7 @@ using System.Windows.Input;
namespace Xamarin.Forms
{
- public class MenuItem : BaseMenuItem
+ public class MenuItem : BaseMenuItem, IMenuItemController
{
public static readonly BindableProperty TextProperty = BindableProperty.Create("Text", typeof(string), typeof(MenuItem), null);
@@ -19,6 +19,14 @@ namespace Xamarin.Forms
internal static readonly BindableProperty IsEnabledProperty = BindableProperty.Create("IsEnabled", typeof(bool), typeof(ToolbarItem), true);
+ string IMenuItemController.IsEnabledPropertyName
+ {
+ get
+ {
+ return IsEnabledProperty.PropertyName;
+ }
+ }
+
public ICommand Command
{
get { return (ICommand)GetValue(CommandProperty); }
@@ -55,6 +63,14 @@ namespace Xamarin.Forms
set { SetValue(IsEnabledProperty, value); }
}
+ bool IMenuItemController.IsEnabled
+ {
+ get
+ {
+ return IsEnabled;
+ }
+ }
+
bool IsEnabledCore
{
set { SetValueCore(IsEnabledProperty, value); }
@@ -69,7 +85,7 @@ namespace Xamarin.Forms
handler(this, EventArgs.Empty);
}
- internal void Activate()
+ void IMenuItemController.Activate()
{
if (Command != null)
{
diff --git a/Xamarin.Forms.Core/ScrollToRequestedEventArgs.cs b/Xamarin.Forms.Core/ScrollToRequestedEventArgs.cs
index 28231df7..6570328d 100644
--- a/Xamarin.Forms.Core/ScrollToRequestedEventArgs.cs
+++ b/Xamarin.Forms.Core/ScrollToRequestedEventArgs.cs
@@ -2,7 +2,7 @@
namespace Xamarin.Forms
{
- public class ScrollToRequestedEventArgs : EventArgs
+ public class ScrollToRequestedEventArgs : EventArgs, ITemplatedItemsListScrollToRequestedEventArgs
{
internal ScrollToRequestedEventArgs(double scrollX, double scrollY, bool shouldAnimate)
{
@@ -50,7 +50,22 @@ namespace Xamarin.Forms
public bool ShouldAnimate { get; private set; }
internal object Group { get; private set; }
+ object ITemplatedItemsListScrollToRequestedEventArgs.Group
+ {
+ get
+ {
+ return Group;
+ }
+ }
internal object Item { get; private set; }
+ object ITemplatedItemsListScrollToRequestedEventArgs.Item
+ {
+ get
+ {
+ return Item;
+ }
+ }
+
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/TableModel.cs b/Xamarin.Forms.Core/TableModel.cs
index 866b7a69..e570b22b 100644
--- a/Xamarin.Forms.Core/TableModel.cs
+++ b/Xamarin.Forms.Core/TableModel.cs
@@ -2,7 +2,7 @@ using System;
namespace Xamarin.Forms
{
- internal abstract class TableModel
+ internal abstract class TableModel: ITableModel
{
public virtual Cell GetCell(int section, int row)
{
diff --git a/Xamarin.Forms.Core/TableView.cs b/Xamarin.Forms.Core/TableView.cs
index a88999b7..bd9f964e 100644
--- a/Xamarin.Forms.Core/TableView.cs
+++ b/Xamarin.Forms.Core/TableView.cs
@@ -3,12 +3,13 @@ using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using Xamarin.Forms.Platform;
+using Xamarin.Forms.Internals;
namespace Xamarin.Forms
{
[ContentProperty("Root")]
[RenderWith(typeof(_TableViewRenderer))]
- public class TableView : View
+ public class TableView : View, ITableViewController
{
public static readonly BindableProperty RowHeightProperty = BindableProperty.Create("RowHeight", typeof(int), typeof(TableView), -1);
@@ -85,6 +86,13 @@ namespace Xamarin.Forms
OnModelChanged();
}
}
+ ITableModel ITableViewController.Model
+ {
+ get
+ {
+ return Model;
+ }
+ }
protected override void OnBindingContextChanged()
{
@@ -113,6 +121,11 @@ namespace Xamarin.Forms
}
internal event EventHandler ModelChanged;
+ event EventHandler ITableViewController.ModelChanged
+ {
+ add { ModelChanged += value; }
+ remove { ModelChanged -= value; }
+ }
void CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
diff --git a/Xamarin.Forms.Core/TemplatedItemsList.cs b/Xamarin.Forms.Core/TemplatedItemsList.cs
index 814f5835..75a0d394 100644
--- a/Xamarin.Forms.Core/TemplatedItemsList.cs
+++ b/Xamarin.Forms.Core/TemplatedItemsList.cs
@@ -6,11 +6,14 @@ using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using Cadenza.Collections;
+using Xamarin.Forms.Internals;
namespace Xamarin.Forms
{
- internal sealed class TemplatedItemsList<TView, TItem> : BindableObject, IReadOnlyList<TItem>, IList, INotifyCollectionChanged, IDisposable where TView : BindableObject, IItemsView<TItem>
- where TItem : BindableObject
+
+ internal sealed class TemplatedItemsList<TView, TItem> : BindableObject, ITemplatedItemsList<TItem>, IList, IDisposable
+ where TView : BindableObject, IItemsView<TItem>
+ where TItem : BindableObject
{
public static readonly BindableProperty NameProperty = BindableProperty.Create("Name", typeof(string), typeof(TemplatedItemsList<TView, TItem>), null);
@@ -85,6 +88,12 @@ namespace Xamarin.Forms
ListProxy = new ListProxy(new object[0]);
}
+ event PropertyChangedEventHandler ITemplatedItemsList<TItem>.PropertyChanged
+ {
+ add { PropertyChanged += value; }
+ remove { PropertyChanged -= value; }
+ }
+
public BindingBase GroupDisplayBinding
{
get { return _groupDisplayBinding; }
@@ -179,9 +188,9 @@ namespace Xamarin.Forms
}
}
- internal ListProxy ListProxy
+ internal IListProxy ListProxy
{
- get { return (ListProxy)GetValue(ListProxyPropertyKey.BindableProperty); }
+ get { return (IListProxy)GetValue(ListProxyPropertyKey.BindableProperty); }
private set { SetValue(ListProxyPropertyKey, value); }
}
@@ -337,7 +346,7 @@ namespace Xamarin.Forms
return count;
}
- public int GetGlobalIndexForGroup(TemplatedItemsList<TView, TItem> group)
+ public int GetGlobalIndexForGroup(ITemplatedItemsList<TItem> group)
{
if (group == null)
throw new ArgumentNullException("group");
@@ -493,6 +502,11 @@ namespace Xamarin.Forms
}
public event NotifyCollectionChangedEventHandler GroupedCollectionChanged;
+ event NotifyCollectionChangedEventHandler ITemplatedItemsList<TItem>.GroupedCollectionChanged
+ {
+ add { GroupedCollectionChanged += value; }
+ remove { GroupedCollectionChanged -= value; }
+ }
public int IndexOf(TItem item)
{
@@ -536,6 +550,11 @@ namespace Xamarin.Forms
return _groupedItems[index];
}
+ ITemplatedItemsList<TItem> ITemplatedItemsList<TItem>.GetGroup(int index)
+ {
+ return GetGroup(index);
+ }
+
internal static TemplatedItemsList<TView, TItem> GetGroup(TItem item)
{
if (item == null)
@@ -590,6 +609,10 @@ namespace Xamarin.Forms
object item = ListProxy[index];
return UpdateContent(content, index, item);
}
+ TItem ITemplatedItemsList<TItem>.UpdateContent(TItem content, int index)
+ {
+ return UpdateContent(content, index);
+ }
internal TItem UpdateHeader(TItem content, int groupIndex)
{
@@ -608,6 +631,10 @@ namespace Xamarin.Forms
return content;
}
+ TItem ITemplatedItemsList<TItem>.UpdateHeader(TItem content, int groupIndex)
+ {
+ return UpdateHeader(content, groupIndex);
+ }
void BindableOnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
@@ -644,6 +671,14 @@ namespace Xamarin.Forms
return (IEnumerable)_itemsView.GetValue(_itemSourceProperty);
}
+ object ITemplatedItemsList<TItem>.BindingContext
+ {
+ get
+ {
+ return BindingContext;
+ }
+ }
+
void GroupedReset()
{
if (_groupedItems != null)
diff --git a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
index 55b60bbc..3ba0c05b 100644
--- a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
+++ b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
@@ -64,6 +64,8 @@
<Compile Include="BoundsTypeConverter.cs" />
<Compile Include="CastingEnumerator.cs" />
<Compile Include="Cells\EntryCell.cs" />
+ <Compile Include="Cells\ICellController.cs" />
+ <Compile Include="Cells\IEntryCellController.cs" />
<Compile Include="Cells\ImageCell.cs" />
<Compile Include="Cells\INativeElementView.cs" />
<Compile Include="ChatKeyboard.cs" />
@@ -84,6 +86,8 @@
<Compile Include="DataTemplateSelector.cs" />
<Compile Include="DateChangedEventArgs.cs" />
<Compile Include="DelegateLogListener.cs" />
+ <Compile Include="EnumerableExtensions.cs" />
+ <Compile Include="IFontElement.cs" />
<Compile Include="DependencyAttribute.cs" />
<Compile Include="DependencyFetchTarget.cs" />
<Compile Include="DeviceOrientation.cs" />
@@ -92,6 +96,8 @@
<Compile Include="ElementEventArgs.cs" />
<Compile Include="ElementTemplate.cs" />
<Compile Include="EmailKeyboard.cs" />
+ <Compile Include="IListProxy.cs" />
+ <Compile Include="IMenuItemController.cs" />
<Compile Include="IEntryController.cs" />
<Compile Include="IImageController.cs" />
<Compile Include="INavigationPageController.cs" />
@@ -119,7 +125,6 @@
<Compile Include="IElementController.cs" />
<Compile Include="IExpressionSearch.cs" />
<Compile Include="IExtendedTypeConverter.cs" />
- <Compile Include="IFontElement.cs" />
<Compile Include="IGestureRecognizer.cs" />
<Compile Include="IItemsView.cs" />
<Compile Include="IItemViewController.cs" />
@@ -134,6 +139,7 @@
<Compile Include="IPageController.cs" />
<Compile Include="IPanGestureController.cs" />
<Compile Include="IPinchGestureController.cs" />
+ <Compile Include="IPlatform.cs" />
<Compile Include="IProvideParentValues.cs" />
<Compile Include="IProvideValueTarget.cs" />
<Compile Include="IRegisterable.cs" />
@@ -141,6 +147,11 @@
<Compile Include="IResourcesProvider.cs" />
<Compile Include="IRootObjectProvider.cs" />
<Compile Include="IScrollViewController.cs" />
+ <Compile Include="ITableModel.cs" />
+ <Compile Include="ITableViewController.cs" />
+ <Compile Include="ITemplatedItemsList.cs" />
+ <Compile Include="ITemplatedItemsListScrollToRequestedEventArgs.cs" />
+ <Compile Include="ITemplatedItemsView.cs" />
<Compile Include="ISearchBarController.cs" />
<Compile Include="IStreamImageSource.cs" />
<Compile Include="ItemTappedEventArgs.cs" />
@@ -174,8 +185,8 @@
<Compile Include="NavigationEventArgs.cs" />
<Compile Include="NavigationModel.cs" />
<Compile Include="Internals\NavigationRequestedEventArgs.cs" />
- <Compile Include="NotifyCollectionChangedEventArgsEx.cs" />
- <Compile Include="NotifyCollectionChangedEventArgsExtensions.cs" />
+ <Compile Include="Internals\NotifyCollectionChangedEventArgsEx.cs" />
+ <Compile Include="Internals\NotifyCollectionChangedEventArgsExtensions.cs" />
<Compile Include="NullEffect.cs" />
<Compile Include="NumericKeyboard.cs" />
<Compile Include="ObservableList.cs" />
@@ -203,6 +214,7 @@
<Compile Include="ReadOnlyCastingList.cs" />
<Compile Include="ReadOnlyListAdapter.cs" />
<Compile Include="RectangleTypeConverter.cs" />
+ <Compile Include="Registrar.cs" />
<Compile Include="RenderWithAttribute.cs" />
<Compile Include="ResolutionGroupNameAttribute.cs" />
<Compile Include="ResourcesChangedEventArgs.cs" />
@@ -230,6 +242,7 @@
<Compile Include="TelephoneKeyboard.cs" />
<Compile Include="TemplateBinding.cs" />
<Compile Include="TemplatedItemsList.cs" />
+ <Compile Include="Internals\CellExtensions.cs" />
<Compile Include="TemplatedPage.cs" />
<Compile Include="TemplatedView.cs" />
<Compile Include="TemplateUtilities.cs" />
@@ -265,8 +278,6 @@
<Compile Include="Color.cs" />
<Compile Include="ResourceDictionary.cs" />
<Compile Include="EventArg.cs" />
- <Compile Include="IPlatform.cs" />
- <Compile Include="EnumerableExtensions.cs" />
<Compile Include="Size.cs" />
<Compile Include="GestureState.cs" />
<Compile Include="Point.cs" />
@@ -286,7 +297,6 @@
<Compile Include="DataTemplate.cs" />
<Compile Include="ListProxy.cs" />
<Compile Include="AbsoluteLayout.cs" />
- <Compile Include="Registrar.cs" />
<Compile Include="ActivityIndicator.cs" />
<Compile Include="BoxView.cs" />
<Compile Include="Button.cs" />
@@ -318,7 +328,7 @@
<Compile Include="TabbedPage.cs" />
<Compile Include="TemplateExtensions.cs" />
<Compile Include="TimePicker.cs" />
- <Compile Include="ToolbarTracker.cs" />
+ <Compile Include="Internals\ToolbarTracker.cs" />
<Compile Include="ViewExtensions.cs" />
<Compile Include="ViewState.cs" />
<Compile Include="WeakReferenceExtensions.cs" />