/// <summary> /// Returns an observable that wraps the MouseMove event on an instance /// and all of it's siblings. /// </summary> /// <param name="that">The instance to retrieve the event for.</param> /// <returns>An observable that wraps the MouseMove event on an instance /// and all of it's siblings.</returns> internal static IObservable <IEvent <MouseEventArgs> > GetMouseMoveOnSelfAndSiblings(this UIElement that) { IEnumerable <UIElement> popupRoots = that .GetVisualDescendants() .OfType <Popup>() .Select(popup => popup.Child) .Where(popupRoot => popupRoot != null); return (popupRoots .Select(popupRoot => popupRoot.GetMouseMoveWithOriginalSource()) .Aggregate(that.GetMouseMoveWithOriginalSource(), (left, right) => left.Merge(right))); }