public TwoWayListBinding(IObservableListBinding <T> source, IObservableListBinding <T> target)
 {
     this.forwardBinding = new ListSynchronizer <T>(source, target);
     this.forwardBinding.SourceList.CollectionChanged += OnSourceChanged;
     this.reverseBinding = new ListSynchronizer <T>(target, source);
     this.reverseBinding.SourceList.CollectionChanged += OnTargetChanged;
 }
Example #2
0
 public IndexerBinding(IObservableListBinding <T> source, int index, T defaultValue = default(T))
 {
     this.source                    = source ?? throw new ArgumentNullException(nameof(source));
     this.index                     = index;
     this.defaultValue              = defaultValue;
     this.source.CollectionChanged += OnCollectionChanged;
 }
Example #3
0
        public static IBindingSubscription BindTwoWay <T>(this IObservableListBinding <T> source,
                                                          ObservableCollection <T> target)
        {
            var targetBinding = target.ToBinding();

            return(source.BindTwoWay(targetBinding));
        }
        public OneWayListBinding(IObservableListBinding <T> target,
                                 IReadOnlyObservableValue <IReadOnlyList <T> > sourceValue)
        {
            this.target      = target ?? throw new ArgumentNullException(nameof(target));
            this.sourceValue = sourceValue ?? throw new ArgumentNullException(nameof(sourceValue));
            this.sourceValue.PropertyChanged += OnSourceValueChanged;

            target.Clear();
            target.AddRange(sourceValue.Value);
        }
Example #5
0
 public static IBindingSubscription BindTwoWay <T>(this IObservableListBinding <T> source,
                                                   IObservableListBinding <T> target)
 {
     return(new TwoWayListBinding <T>(target, source));
 }
Example #6
0
 public static IBindingSubscription BindTo <T>(this IReadOnlyObservableListBinding <T> source,
                                               IObservableListBinding <T> target)
 {
     return(new OneWayObservableListBinding <T>(target, source));
 }
Example #7
0
 public static IObservableValue <T> ItemAt <T>(this IObservableListBinding <T> source, int index, T defaultValue = default(T))
 {
     return(new IndexerBinding <T>(source, index, defaultValue));
 }
Example #8
0
 public OneWayObservableListBinding(IObservableListBinding <T> target, IReadOnlyObservableListBinding <T> sourceList)
 {
     this.Target     = target ?? throw new ArgumentNullException(nameof(target));
     this.SourceList = sourceList ?? throw new ArgumentNullException(nameof(sourceList));
     this.SourceList.CollectionChanged += OnSourceCollectionChanged;
 }
Example #9
0
 internal ListEnumerator(IObservableListBinding <T> widget) : this()
 {
     this.widget = widget;
     index       = -1;
     current     = default(T);
 }
Example #10
0
 public ListSynchronizer(IReadOnlyObservableListBinding <T> sourceList, IObservableListBinding <T> target)
 {
     SourceList = sourceList ?? throw new ArgumentNullException(nameof(sourceList));
     Target     = target ?? throw new ArgumentNullException(nameof(target));
 }