diff options
Diffstat (limited to 'Xamarin.Forms.Core/TemplatedItemsList.cs')
-rw-r--r-- | Xamarin.Forms.Core/TemplatedItemsList.cs | 45 |
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) |