diff options
author | Rui Marinho <me@ruimarinho.net> | 2016-09-30 19:48:22 +0100 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-09-30 11:48:22 -0700 |
commit | fa2f01680d23a813a5b1ab7795151b6dcb0feb7f (patch) | |
tree | 74e7d0e301f237cde7a0b1ce4e95d53ebcc80a43 /Xamarin.Forms.Core/NativeBindingHelpers.cs | |
parent | c07c2314f5737d480088319e87ab299b22cb4ddc (diff) | |
download | xamarin-forms-fa2f01680d23a813a5b1ab7795151b6dcb0feb7f.tar.gz xamarin-forms-fa2f01680d23a813a5b1ab7795151b6dcb0feb7f.tar.bz2 xamarin-forms-fa2f01680d23a813a5b1ab7795151b6dcb0feb7f.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/NativeBindingHelpers.cs')
-rw-r--r-- | Xamarin.Forms.Core/NativeBindingHelpers.cs | 9 |
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 +} |