diff options
author | Stephane Delcroix <stephane@delcroix.org> | 2016-11-09 15:15:12 +0100 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-11-16 12:03:13 -0800 |
commit | e5af21fdc32972d4355af86349d446a2bb6a5b02 (patch) | |
tree | 50cde95dcc90832977f5c4caf23eee6cca087601 /Xamarin.Forms.Platform.Android | |
parent | 693cc75068fed11c2760a1e8ef2b05310359bbea (diff) | |
download | xamarin-forms-e5af21fdc32972d4355af86349d446a2bb6a5b02.tar.gz xamarin-forms-e5af21fdc32972d4355af86349d446a2bb6a5b02.tar.bz2 xamarin-forms-e5af21fdc32972d4355af86349d446a2bb6a5b02.zip |
[C] Use a Binding for ItemsSource object selection
Diffstat (limited to 'Xamarin.Forms.Platform.Android')
-rw-r--r-- | Xamarin.Forms.Platform.Android/AppCompat/PickerRenderer.cs | 7 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.Android/Renderers/PickerRenderer.cs | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/Xamarin.Forms.Platform.Android/AppCompat/PickerRenderer.cs b/Xamarin.Forms.Platform.Android/AppCompat/PickerRenderer.cs index 6650d9e6..9587d0ad 100644 --- a/Xamarin.Forms.Platform.Android/AppCompat/PickerRenderer.cs +++ b/Xamarin.Forms.Platform.Android/AppCompat/PickerRenderer.cs @@ -6,6 +6,7 @@ using Android.Content.Res; using Android.Text; using Android.Widget; using Object = Java.Lang.Object; +using System.Collections.Specialized; namespace Xamarin.Forms.Platform.Android.AppCompat { @@ -31,7 +32,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat { _disposed = true; - ((ObservableList<string>)Element.Items).CollectionChanged -= RowsCollectionChanged; + ((INotifyCollectionChanged)Element.Items).CollectionChanged -= RowsCollectionChanged; } base.Dispose(disposing); @@ -40,11 +41,11 @@ namespace Xamarin.Forms.Platform.Android.AppCompat protected override void OnElementChanged(ElementChangedEventArgs<Picker> e) { if (e.OldElement != null) - ((ObservableList<string>)e.OldElement.Items).CollectionChanged -= RowsCollectionChanged; + ((INotifyCollectionChanged)e.OldElement.Items).CollectionChanged -= RowsCollectionChanged; if (e.NewElement != null) { - ((ObservableList<string>)e.NewElement.Items).CollectionChanged += RowsCollectionChanged; + ((INotifyCollectionChanged)e.NewElement.Items).CollectionChanged += RowsCollectionChanged; if (Control == null) { EditText textField = CreateNativeControl(); diff --git a/Xamarin.Forms.Platform.Android/Renderers/PickerRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/PickerRenderer.cs index b6d81718..edfe9e7b 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/PickerRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/PickerRenderer.cs @@ -9,6 +9,7 @@ using ADatePicker = Android.Widget.DatePicker; using ATimePicker = Android.Widget.TimePicker; using Object = Java.Lang.Object; using Orientation = Android.Widget.Orientation; +using System.Collections.Specialized; namespace Xamarin.Forms.Platform.Android { @@ -30,7 +31,7 @@ namespace Xamarin.Forms.Platform.Android if (disposing && !_isDisposed) { _isDisposed = true; - ((ObservableList<string>)Element.Items).CollectionChanged -= RowsCollectionChanged; + ((INotifyCollectionChanged)Element.Items).CollectionChanged -= RowsCollectionChanged; } base.Dispose(disposing); @@ -44,11 +45,11 @@ namespace Xamarin.Forms.Platform.Android protected override void OnElementChanged(ElementChangedEventArgs<Picker> e) { if (e.OldElement != null) - ((ObservableList<string>)e.OldElement.Items).CollectionChanged -= RowsCollectionChanged; + ((INotifyCollectionChanged)e.OldElement.Items).CollectionChanged -= RowsCollectionChanged; if (e.NewElement != null) { - ((ObservableList<string>)e.NewElement.Items).CollectionChanged += RowsCollectionChanged; + ((INotifyCollectionChanged)e.NewElement.Items).CollectionChanged += RowsCollectionChanged; if (Control == null) { var textField = CreateNativeControl(); |