summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core
diff options
context:
space:
mode:
authorRui Marinho <me@ruimarinho.net>2016-09-30 19:48:22 +0100
committerRui Marinho <me@ruimarinho.net>2016-10-04 17:32:34 +0100
commit00a42778203539a0adf6037ba3f4dcad70c1869a (patch)
tree6771f05937b71c60e4902913e486ecb65e6fc452 /Xamarin.Forms.Core
parent65e06eef9051d5930d368f87c87d70044fc27f79 (diff)
downloadxamarin-forms-00a42778203539a0adf6037ba3f4dcad70c1869a.tar.gz
xamarin-forms-00a42778203539a0adf6037ba3f4dcad70c1869a.tar.bz2
xamarin-forms-00a42778203539a0adf6037ba3f4dcad70c1869a.zip
[iOS] Keep our native property listener around the same time we keep our proxy, check if we are KVO compliant before adding observer (#403)
Diffstat (limited to 'Xamarin.Forms.Core')
-rw-r--r--Xamarin.Forms.Core/NativeBindingHelpers.cs9
1 files changed, 6 insertions, 3 deletions
diff --git a/Xamarin.Forms.Core/NativeBindingHelpers.cs b/Xamarin.Forms.Core/NativeBindingHelpers.cs
index 7e2db65b..e4cae7d9 100644
--- a/Xamarin.Forms.Core/NativeBindingHelpers.cs
+++ b/Xamarin.Forms.Core/NativeBindingHelpers.cs
@@ -43,8 +43,10 @@ namespace Xamarin.Forms
propertyChanged.PropertyChanged += (sender, e) => {
if (e.PropertyName != targetProperty)
return;
- SetValueFromNative<TNativeView>(sender as TNativeView, targetProperty, bindableProperty);
- };
+ SetValueFromNative<TNativeView>(sender as TNativeView, targetProperty, bindableProperty);
+ //we need to keep the listener around he same time we have the proxy
+ proxy.NativeINPCListener = propertyChanged;
+ };
if (binding != null && binding.Mode != BindingMode.OneWay)
SetValueFromNative(target, targetProperty, bindableProperty);
@@ -178,6 +180,7 @@ namespace Xamarin.Forms
public WeakReference<TNativeView> TargetReference { get; set; }
public IList<KeyValuePair<BindableProperty, BindingBase>> BindingsBackpack { get; } = new List<KeyValuePair<BindableProperty, BindingBase>>();
public IList<KeyValuePair<BindableProperty, object>> ValuesBackpack { get; } = new List<KeyValuePair<BindableProperty, object>>();
+ public INotifyPropertyChanged NativeINPCListener;
public BindableObjectProxy(TNativeView target)
{
@@ -193,4 +196,4 @@ namespace Xamarin.Forms
}
}
}
-} \ No newline at end of file
+}