/// <summary> /// Creates a new instance of the class. Used by runtime bindings. /// </summary> public RuntimeBinding(List <BindingPath> sources, BindingPath target, bool isTwoWay, BindingType bindingType, Func <object[], object> transformMethod, string formatString) : base(sources, target, null, null, isTwoWay) { PropagateSourceToTarget = PropagateSourceToTargetMethod; PropagateTargetToSource = PropagateTargetToSourceMethod; BindingType = bindingType; TransformMethod = transformMethod; FormatString = formatString; }
/// <summary> /// Removes change listener from object. /// </summary> private void RemoveChangeListener(BindingPath source, object sourceObject) { if (BindableObjectType.IsAssignableFrom(sourceObject.GetType())) { var bindableSourceObject = sourceObject as BindableObject; bindableSourceObject.PropertyChanged -= source.PropertyChanged; } }
/// <summary> /// Creates a new instance of the class. Used by runtime bindings. /// </summary> public RuntimeBinding(List <BindingPath> sources, BindingPath target, bool isTwoWay, BindingType bindingType, Func <Task <object> > transformMethod, string formatString) : base(sources, target, null, null, isTwoWay) { #pragma warning disable CS4014 PropagateSourceToTarget = () => PropagateSourceToTargetMethod(); #pragma warning restore CS4014 PropagateTargetToSource = PropagateTargetToSourceMethod; BindingType = bindingType; TransformMethod = transformMethod; FormatString = formatString; }
/// <summary> /// Creates a new instance of the class. /// </summary> public Binding(List <BindingPath> sources, BindingPath target, Action propagateSourceToTarget, Action propagateTargetToSource, bool isTwoWay) { Sources = sources; Target = target; Target.Binding = this; Target.IsTarget = true; Sources.ForEach(x => x.Binding = this); PropagateSourceToTarget = propagateSourceToTarget; PropagateTargetToSource = propagateTargetToSource; IsTwoWay = isTwoWay; }
/// <summary> /// Adds change listener to object. /// </summary> private void AddChangeListener(BindingPath source, object sourceObject) { if (BindableObjectType.IsAssignableFrom(sourceObject.GetType())) { var bindableSourceObject = sourceObject as BindableObject; bindableSourceObject.PropertyChanged += source.PropertyChanged; } else { if (!HasRegisteredInLayoutRoot) { LayoutRoot.RegisterUpdateable(this); HasRegisteredInLayoutRoot = true; } } }