summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core
diff options
context:
space:
mode:
authorStephane Delcroix <stephane@delcroix.org>2017-01-27 10:16:51 +0100
committerPaul DiPietro <pauldipietro@users.noreply.github.com>2017-02-23 09:37:17 -0600
commit32431a4427f60693394256ff3088c9b156ca798e (patch)
tree6f196698b2ddebd6327c05ebef194daadbfd3917 /Xamarin.Forms.Core
parente8a3cfd75585916881ccb3cae4eca511d0c1d467 (diff)
downloadxamarin-forms-32431a4427f60693394256ff3088c9b156ca798e.tar.gz
xamarin-forms-32431a4427f60693394256ff3088c9b156ca798e.tar.bz2
xamarin-forms-32431a4427f60693394256ff3088c9b156ca798e.zip
[UWP] connect the actual ObservableCollection to the ComboBox.ItemsSource
Diffstat (limited to 'Xamarin.Forms.Core')
-rw-r--r--Xamarin.Forms.Core/Picker.cs23
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 {