diff options
Diffstat (limited to 'Xamarin.Forms.Platform.iOS/NativeViewPropertyListener.cs')
-rw-r--r-- | Xamarin.Forms.Platform.iOS/NativeViewPropertyListener.cs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.iOS/NativeViewPropertyListener.cs b/Xamarin.Forms.Platform.iOS/NativeViewPropertyListener.cs new file mode 100644 index 00000000..ffe117f4 --- /dev/null +++ b/Xamarin.Forms.Platform.iOS/NativeViewPropertyListener.cs @@ -0,0 +1,29 @@ +using System; +using System.ComponentModel; +#if __UNIFIED__ +using Foundation; + +#else +using MonoTouch.Foundation; +#endif + +namespace Xamarin.Forms.Platform.iOS +{ + class NativeViewPropertyListener : NSObject, INotifyPropertyChanged + { + string TargetProperty { get; set; } + + public NativeViewPropertyListener(string targetProperty) + { + TargetProperty = targetProperty; + } + + public event PropertyChangedEventHandler PropertyChanged; + + public override void ObserveValue(NSString keyPath, NSObject ofObject, NSDictionary change, IntPtr context) + { + if (keyPath == TargetProperty) + PropertyChanged?.Invoke(ofObject, new PropertyChangedEventArgs(TargetProperty)); + } + } +} |