示例#1
0
        protected TwoWayBinding(
            OneWayBinding <T> oneWayBinding,
            OneWayToSourceBinding <T> oneWayToSourceBinding,
            BindingResolutionMode resolutionMode)
            : this(resolutionMode)
        {
            this.oneWayBinding         = oneWayBinding;
            this.oneWayToSourceBinding = oneWayToSourceBinding;

            if (this.oneWayBinding.ResolutionMode != this.oneWayToSourceBinding.ResolutionMode)
            {
                throw new ArgumentException("Both bindings must share the same ResolutionMode");
            }
        }
示例#2
0
 public TwoWayBinding(PropertyInfo propertyInfo)
     : this(BindingResolutionMode.Deferred)
 {
     this.oneWayBinding         = new OneWayBinding <T>(propertyInfo);
     this.oneWayToSourceBinding = new OneWayToSourceBinding <T>(propertyInfo);
 }
示例#3
0
 public TwoWayBinding(object source, PropertyInfo propertyInfo)
     : this(BindingResolutionMode.Immediate)
 {
     this.oneWayBinding         = new OneWayBinding <T>(source, propertyInfo);
     this.oneWayToSourceBinding = new OneWayToSourceBinding <T>(source, propertyInfo);
 }
示例#4
0
 /// <summary>
 ///     Creates a One Way Binding directly to a source object
 ///     where the Type of the source is different from the Type of the target property and requires conversion.
 /// </summary>
 /// <typeparam name = "TSource">The Type of the source.</typeparam>
 /// <typeparam name = "TTargetProp">The Type of the property on the target.</typeparam>
 /// <param name = "source">The binding source.</param>
 /// <returns>IObservable around the source.</returns>
 public static IObservable <TTargetProp> CreateOneWay <TSource, TTargetProp>(TSource source)
 {
     return(new OneWayBinding <TTargetProp>(OneWayBinding <TTargetProp> .Convert(source)));
 }