/// <summary> /// Returns an observable that returns a value indicating /// whether escape is pressed, even if one of the events involved /// is handled or occurs in a sibling. /// </summary> /// <param name="that">The element to listen to.</param> /// <returns>An observable that returns a value indicating /// whether escape is pressed, even if one of the events involved /// is handled or occurs in a sibling.</returns> internal static IObservable <bool> GetEscapePressedChangedOnSelfAndSiblingsAlways(this UIElement that) { return (Observable.Merge( that .GetKeyUpOnSelfAndSiblingsAlways() .Where(ev => ev.EventArgs.Key == Key.Escape) .Select(ev => false), that .GetKeyUpOnSelfAndSiblingsAlways() .Where(ev => ev.EventArgs.Key == Key.Escape) .Select(ev => true))); }