private void OnBeforeAddedToVisualTree() { Application.FocusManager.Push(); myFocusStackDepth = Application.FocusManager.StackDepth; Application.FocusManager.GlobalKeyHandlers.PushForLifetime(ConsoleKey.Escape, null, Escape,LifetimeManager ); }