summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core/TemplatedItemsList.cs
diff options
context:
space:
mode:
authorSamantha Houts <samantha@teamredwall.com>2016-06-17 03:10:18 -0700
committerRui Marinho <me@ruimarinho.net>2016-06-17 11:10:18 +0100
commit925fc0aa588a060eb23fa16c1d225dd030012c23 (patch)
tree83676c25c29d97d9250516b217020ba85425796d /Xamarin.Forms.Core/TemplatedItemsList.cs
parentd44396a4534b1e2bc81143c809e4adaee656ab15 (diff)
downloadxamarin-forms-925fc0aa588a060eb23fa16c1d225dd030012c23.tar.gz
xamarin-forms-925fc0aa588a060eb23fa16c1d225dd030012c23.tar.bz2
xamarin-forms-925fc0aa588a060eb23fa16c1d225dd030012c23.zip
Prep Cell & friends for removal of InternalsVisibleTo (#142)
* Prep Cell & friends for removal of InternalsVisibleTo Includes: - Cell - EntryCell - ListView - MenuItem - TableView - ViewCell - Toolbar Moved extensions to Internal & removed TPH * Update docs * [Controls] Ignore Issue2411 on iOS <9 * [Controls] Formatting for Issue2411
Diffstat (limited to 'Xamarin.Forms.Core/TemplatedItemsList.cs')
-rw-r--r--Xamarin.Forms.Core/TemplatedItemsList.cs45
1 files changed, 40 insertions, 5 deletions
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)