public static void SetBinding(this FrameworkElement view, string propertyName, BindingBase bindingBase, string updateSourceEventName = null) { var binding = bindingBase as Binding; updateSourceEventName = updateSourceEventName ?? binding?.UpdateSourceEventName; if (IsNullOrEmpty(updateSourceEventName)) { NativePropertyListener nativePropertyListener = null; if (bindingBase.Mode == BindingMode.TwoWay) { nativePropertyListener = new NativePropertyListener(view, propertyName); } PlatformBindingHelpers.SetBinding(view, propertyName, bindingBase, nativePropertyListener as INotifyPropertyChanged); return; } NativeEventWrapper eventE = null; if (binding.Mode == BindingMode.TwoWay && !(view is INotifyPropertyChanged)) { eventE = new NativeEventWrapper(view, propertyName, updateSourceEventName); } PlatformBindingHelpers.SetBinding(view, propertyName, binding, eventE); }
public static void SetBinding(this UIView view, string propertyName, BindingBase bindingBase, string updateSourceEventName = null) { var binding = bindingBase as Binding; //This will allow setting bindings from Xaml by reusing the MarkupExtension updateSourceEventName = updateSourceEventName ?? binding?.UpdateSourceEventName; if (!IsNullOrEmpty(updateSourceEventName)) { PlatformBindingHelpers.SetBinding(view, propertyName, bindingBase, updateSourceEventName); return; } NativeViewPropertyListener nativePropertyListener = null; if (bindingBase.Mode == BindingMode.TwoWay) { nativePropertyListener = new NativeViewPropertyListener(propertyName); try { //TODO: We need to figure a way to map the value back to the real objectiveC property. //the X.IOS camelcase property name won't work var key = new Foundation.NSString(propertyName.ToLower()); var valueKey = view.ValueForKey(key); if (valueKey != null) { view.AddObserver(nativePropertyListener, key, Foundation.NSKeyValueObservingOptions.New, IntPtr.Zero); } } #if __MOBILE__ catch (Foundation.MonoTouchException ex) { nativePropertyListener = null; if (ex.Name == "NSUnknownKeyException") { System.Diagnostics.Debug.WriteLine("KVO not supported, try specify a UpdateSourceEventName instead."); return; } throw ex; } #else catch (Exception ex) { throw ex; } #endif } PlatformBindingHelpers.SetBinding(view, propertyName, bindingBase, nativePropertyListener); }
public static void SetBindingContext(this UIView target, object bindingContext, Func <UIView, IEnumerable <UIView> > getChildren = null) { PlatformBindingHelpers.SetBindingContext(target, bindingContext, getChildren); }
public static void SetBinding(this UIView self, BindableProperty targetProperty, BindingBase binding) { PlatformBindingHelpers.SetBinding(self, targetProperty, binding); }
internal static void TransferbindablePropertiesToWrapper(this FrameworkElement target, View wrapper) { PlatformBindingHelpers.TransferBindablePropertiesToWrapper(target, wrapper); }
public static void SetBinding(this EObject view, BindableProperty targetProperty, BindingBase binding) { PlatformBindingHelpers.SetBinding(view, targetProperty, binding); }
public static void SetBindingContext(this MockPlatformView target, object bindingContext, Func <MockPlatformView, IEnumerable <MockPlatformView> > getChild = null) { PlatformBindingHelpers.SetBindingContext(target, bindingContext, getChild); }
public static void SetBinding(this MockPlatformView target, BindableProperty targetProperty, BindingBase binding) { PlatformBindingHelpers.SetBinding(target, targetProperty, binding); }
public static void SetBinding(this global::Android.Views.View view, string propertyName, BindingBase binding, string updateSourceEventName = null) { PlatformBindingHelpers.SetBinding(view, propertyName, binding, updateSourceEventName); }
internal static void TransferBindablePropertiesToWrapper(this global::Android.Views.View target, View wrapper) { PlatformBindingHelpers.TransferBindablePropertiesToWrapper(target, wrapper); }
public static void SetValue(this global::Android.Views.View target, BindableProperty targetProperty, object value) { PlatformBindingHelpers.SetValue(target, targetProperty, value); }
public static void SetBinding(this global::Android.Views.View view, BindableProperty targetProperty, BindingBase binding) { PlatformBindingHelpers.SetBinding(view, targetProperty, binding); }
public static void SetBinding(this EObject view, string propertyName, BindingBase binding, string updateSourceEventName = null) { PlatformBindingHelpers.SetBinding(view, propertyName, binding, updateSourceEventName); }
internal static void TransferBindablePropertiesToWrapper(this EObject target, View wrapper) { PlatformBindingHelpers.TransferBindablePropertiesToWrapper(target, wrapper); }
public static void SetBinding(this MockPlatformView target, string targetProperty, BindingBase binding, string updateSourceEventName = null) { PlatformBindingHelpers.SetBinding(target, targetProperty, binding, updateSourceEventName); }
internal static void SetBinding(this MockPlatformView target, string targetProperty, BindingBase binding, INotifyPropertyChanged propertyChanged) { PlatformBindingHelpers.SetBinding(target, targetProperty, binding, propertyChanged); }
// TODO MAUI //public static void SetBinding(this FrameworkElement view, string propertyName, BindingBase bindingBase, string updateSourceEventName = null) //{ // var binding = bindingBase as Binding; // updateSourceEventName = updateSourceEventName ?? binding?.UpdateSourceEventName; // if (IsNullOrEmpty(updateSourceEventName)) // { // NativePropertyListener nativePropertyListener = null; // if (bindingBase.Mode == BindingMode.TwoWay) // nativePropertyListener = new NativePropertyListener(view, propertyName); // PlatformBindingHelpers.SetBinding(view, propertyName, bindingBase, nativePropertyListener as INotifyPropertyChanged); // return; // } // NativeEventWrapper eventE = null; // if (binding.Mode == BindingMode.TwoWay && !(view is INotifyPropertyChanged)) // eventE = new NativeEventWrapper(view, propertyName, updateSourceEventName); // PlatformBindingHelpers.SetBinding(view, propertyName, binding, eventE); //} public static void SetBinding(this FrameworkElement view, BindableProperty targetProperty, BindingBase binding) { PlatformBindingHelpers.SetBinding(view, targetProperty, binding); }
public static void SetValue(this MockPlatformView target, BindableProperty targetProperty, object value) { PlatformBindingHelpers.SetValue(target, targetProperty, value); }
public static void SetValue(this FrameworkElement target, BindableProperty targetProperty, object value) { PlatformBindingHelpers.SetValue(target, targetProperty, value); }
internal static void TransferbindablePropertiesToWrapper(this MockPlatformView target, MockPlatformViewWrapper wrapper) { PlatformBindingHelpers.TransferBindablePropertiesToWrapper(target, wrapper); }
public static void SetBindingContext(this FrameworkElement target, object bindingContext, Func <FrameworkElement, IEnumerable <FrameworkElement> > getChildren = null) { PlatformBindingHelpers.SetBindingContext(target, bindingContext, getChildren); }