diff options
author | Stephane Delcroix <stephane@delcroix.org> | 2017-01-27 10:16:51 +0100 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2017-03-10 14:33:26 +0000 |
commit | f304d2bd9b5e92ffb6f0ac74bb6ce79395c5c9b5 (patch) | |
tree | 1d30188359b833f70c7ffceb6d430946aa14e277 /Xamarin.Forms.Core | |
parent | 6ef2f23417ef4fc857da0d964ce8021d5da60314 (diff) | |
download | xamarin-forms-f304d2bd9b5e92ffb6f0ac74bb6ce79395c5c9b5.tar.gz xamarin-forms-f304d2bd9b5e92ffb6f0ac74bb6ce79395c5c9b5.tar.bz2 xamarin-forms-f304d2bd9b5e92ffb6f0ac74bb6ce79395c5c9b5.zip |
[UWP] connect the actual ObservableCollection to the ComboBox.ItemsSource
Diffstat (limited to 'Xamarin.Forms.Core')
-rw-r--r-- | Xamarin.Forms.Core/Picker.cs | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/Xamarin.Forms.Core/Picker.cs b/Xamarin.Forms.Core/Picker.cs index 56dc4d1a..ae179696 100644 --- a/Xamarin.Forms.Core/Picker.cs +++ b/Xamarin.Forms.Core/Picker.cs @@ -1,7 +1,10 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Collections.Specialized; +using System.ComponentModel; +using System.Runtime.CompilerServices; using Xamarin.Forms.Platform; namespace Xamarin.Forms @@ -217,23 +220,29 @@ namespace Xamarin.Forms return _platformConfigurationRegistry.Value.On<T>(); } - class LockableObservableListWrapper : INotifyCollectionChanged, IList<string> + internal class LockableObservableListWrapper : IList<string>, ICollection<string>, INotifyCollectionChanged, INotifyPropertyChanged, IReadOnlyList<string>, IReadOnlyCollection<string>, IEnumerable<string>, IEnumerable { - readonly ObservableList<string> _list = new ObservableList<string>(); + internal readonly ObservableCollection<string> _list = new ObservableCollection<string>(); - public bool IsLocked { get; set; } + event NotifyCollectionChangedEventHandler INotifyCollectionChanged.CollectionChanged + { + add { ((INotifyCollectionChanged)_list).CollectionChanged += value; } + remove { ((INotifyCollectionChanged)_list).CollectionChanged -= value; } + } - event NotifyCollectionChangedEventHandler INotifyCollectionChanged.CollectionChanged { - add { _list.CollectionChanged += value; } - remove { _list.CollectionChanged -= value; } + event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged { + add { ((INotifyPropertyChanged)_list).PropertyChanged += value; } + remove { ((INotifyPropertyChanged)_list).PropertyChanged -= value; } } + public bool IsLocked { get; set; } + void ThrowOnLocked() { if (IsLocked) throw new InvalidOperationException("The Items list can not be manipulated if the ItemsSource property is set"); - } + public string this [int index] { get { return _list [index]; } set { |