public static void TransferBindingsToWindow(IInputElement src, IInputElement dst, bool remove) { src.CheckNotNull(nameof(src)); dst.CheckNotNull(nameof(dst)); for (var i = src.KeyBindings.Count - 1; i >= 0; i--) { var key = src.KeyBindings[i]; dst.KeyBindings.Add(key); if (remove) { src.KeyBindings.Remove(key); } } }