Ejemplo n.º 1
0
 /// <summary>
 /// Initialites a two-way bind between <see cref="PerspexProperty"/>s.
 /// </summary>
 /// <param name="property">The property on this object.</param>
 /// <param name="source">The source object.</param>
 /// <param name="sourceProperty">The property on the source object.</param>
 /// <param name="priority">The priority of the binding.</param>
 /// <returns>
 /// A disposable which can be used to terminate the binding.
 /// </returns>
 /// <remarks>
 /// The binding is first carried out from <paramref name="source"/> to this.
 /// </remarks>
 public IDisposable BindTwoWay(
     PerspexProperty property,
     PerspexObject source,
     PerspexProperty sourceProperty,
     BindingPriority priority = BindingPriority.LocalValue)
 {
     return(new CompositeDisposable(
                Bind(property, source.GetObservable(sourceProperty)),
                source.Bind(sourceProperty, GetObservable(property))));
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initiates a two-way binding between <see cref="PerspexProperty"/>s.
        /// </summary>
        /// <param name="property">The property on this object.</param>
        /// <param name="source">The source object.</param>
        /// <param name="sourceProperty">The property on the source object.</param>
        /// <param name="priority">The priority of the binding.</param>
        /// <returns>
        /// A disposable which can be used to terminate the binding.
        /// </returns>
        /// <remarks>
        /// The binding is first carried out from <paramref name="source"/> to this.
        /// </remarks>
        public IDisposable BindTwoWay(
            PerspexProperty property,
            PerspexObject source,
            PerspexProperty sourceProperty,
            BindingPriority priority = BindingPriority.LocalValue)
        {
            VerifyAccess();
            _propertyLog.Verbose(
                "Bound two way {Property} to {Binding} with priority {Priority}",
                property,
                source,
                priority);

            return(new CompositeDisposable(
                       Bind(property, source.GetObservable(sourceProperty)),
                       source.Bind(sourceProperty, GetObservable(property))));
        }