private static void OnIsOverflowOpenChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            RibbonQuickAccessToolBar qat = (RibbonQuickAccessToolBar)sender;

            if (!qat.IsOverflowOpen)
            {
                // If the overflow drop down is closed due to
                // an action of context menu then ContextMenuClosed
                // event is never raised. Hence reset the flag.
                qat.InContextMenu = false;
            }

            UIElement popupChild = qat._overflowPopup.TryGetChild();

            RibbonHelper.HandleIsDropDownChanged(
                qat,
                delegate() { return(qat.IsOverflowOpen); },
                popupChild,
                popupChild);

            if ((bool)(e.NewValue))
            {
                qat.RetainFocusOnEscape = RibbonHelper.IsKeyboardMostRecentInputDevice();
            }

            // Raise UI Automation Events
            RibbonQuickAccessToolBarAutomationPeer peer = UIElementAutomationPeer.FromElement(qat) as RibbonQuickAccessToolBarAutomationPeer;

            if (peer != null)
            {
                peer.RaiseExpandCollapseAutomationEvent(!(bool)e.OldValue, !(bool)e.NewValue);
            }
        }