diff options
Diffstat (limited to 'Xamarin.Forms.Platform.iOS/NativeViewPropertyListener.cs')
-rw-r--r-- | Xamarin.Forms.Platform.iOS/NativeViewPropertyListener.cs | 24 |
1 files changed, 24 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..2d872af2 --- /dev/null +++ b/Xamarin.Forms.Platform.iOS/NativeViewPropertyListener.cs @@ -0,0 +1,24 @@ +using System; +using System.ComponentModel; +using Foundation; + +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)); + } + } +} |