/// <summary> /// Forwards the <paramref name="source" /> changes to the <paramref name="target" />. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="source">The source observable list.</param> /// <param name="target">The target binding list.</param> /// <param name="includeItemChanges">if set to <c>true</c> individual items' changes will be propagated to the /// <paramref name="target" /> via replacing the item completely.</param> /// <param name="includeMoves">if set to <c>true</c> move operations will be replicated to the <paramref name="target" />.</param> /// <param name="scheduler">The scheduler.</param> /// <returns></returns> /// <exception cref="System.ArgumentNullException">source /// or /// target</exception> /// <exception cref="System.InvalidOperationException">Source and Target Lists must contain exactly the same element(s) at /// the exact same index position(s)</exception> public static IDisposable ForwardListChangesTo <T>( this IObservableList <T> source, IEnhancedBindingList <T> target, bool includeItemChanges = true, bool includeMoves = false, IScheduler scheduler = null) { if (source == null) { throw new ArgumentNullException(nameof(source)); } if (target == null) { throw new ArgumentNullException(nameof(target)); } if (includeMoves && (source.Except(target).Any() || target.Except(source).Any() || source.Any(element => source.IndexOf(element) != target.IndexOf(element)))) { throw new InvalidOperationException("Source and Target Lists must contain exactly the same element(s) at the exact same index position(s)"); } IObservable <IObservableListChange <T> > sourceObservable = scheduler != null ? source.ListChanges.ObserveOn(scheduler) : source.ListChanges; return(sourceObservable.ForwardListChangesTo(target, includeItemChanges, includeMoves)); }