Event args for DismissPopup event.
상속: System.Windows.RoutedEventArgs
예제 #1
0
 internal override void OnDismissPopup(RibbonDismissPopupEventArgs e)
 {
     if (e.OriginalSource == _partArrowButton)
     {
         // Clicking on Arrow should not dismiss the parent popup
         e.Handled = true;
         return;
     }
     base.OnDismissPopup(e);
 }
예제 #2
0
        private void OnDismissPopup(RibbonDismissPopupEventArgs e)
        {
            UIElement popupChild = _overflowPopup.TryGetChild();

            RibbonHelper.HandleDismissPopup(
                e,
                delegate(bool value) { IsOverflowOpen = value; },
                delegate(DependencyObject d) { return(d == _overflowButton); },
                popupChild,
                this);
        }
예제 #3
0
        protected override void OnDismissPopup(RibbonDismissPopupEventArgs e)
        {
            base.OnDismissPopup(e);

            if (e.DismissMode == RibbonDismissPopupMode.Always)
            {
                // DismissPopup in RibbonFilterMenuButton shouldn't dismiss the parent Popup.
                // Retain focus on self if needed.
                if (_retainFocusOnDismiss)
                {
                    Focus();
                    _retainFocusOnDismiss = false;
                }
                e.Handled = true;
            }
        }
        protected override void OnDismissPopup(RibbonDismissPopupEventArgs e)
        {
            base.OnDismissPopup(e);

            if (e.DismissMode == RibbonDismissPopupMode.Always)
            {
                // DismissPopup in RibbonFilterMenuButton shouldn't dismiss the parent Popup.
                // Retain focus on self if needed.
                if (_retainFocusOnDismiss)
                {
                    Focus();
                    _retainFocusOnDismiss = false;
                }
                e.Handled = true;
            }
        }
예제 #5
0
        private static void OnDismissPopupThunk(object sender, RibbonDismissPopupEventArgs e)
        {
            RibbonQuickAccessToolBar qat = (RibbonQuickAccessToolBar)sender;

            qat.OnDismissPopup(e);
        }
예제 #6
0
        internal static void HandleDropDownKeyDown(
            object sender, KeyEventArgs e, Func<bool> gettor, Action<bool> settor, UIElement targetFocusOnFalse, UIElement targetFocusContainerOnTrue)
        {
            Key key = e.Key;
            switch (key)
            {
                case Key.Escape:
                    {
                        if (gettor())
                        {
                            settor(false);
                            e.Handled = true;
                            if (targetFocusOnFalse != null)
                            {
                                targetFocusOnFalse.Focus();
                            }
                        }
                    }
                    break;

                case Key.System:
                    if ((e.SystemKey == Key.LeftAlt) ||
                        (e.SystemKey == Key.RightAlt) ||
                        (e.SystemKey == Key.F10))
                    {
                        if (gettor())
                        {
                            // Raise DismissPopup event and hence the key down event.
                            UIElement uie = sender as UIElement;
                            if (uie != null)
                            {
                                RibbonDismissPopupEventArgs dismissArgs = new RibbonDismissPopupEventArgs();
                                uie.RaiseEvent(dismissArgs);
                                e.Handled = true;
                            }
                        }
                    }
                    break;
                case Key.F4:
                    {
                        if (gettor())
                        {
                            settor(false);
                            e.Handled = true;
                            if (targetFocusOnFalse != null)
                            {
                                targetFocusOnFalse.Focus();
                            }
                        }
                        else
                        {
                            settor(true);
                            if (targetFocusContainerOnTrue != null)
                            {
                                targetFocusContainerOnTrue.Dispatcher.BeginInvoke(
                                    (Action)delegate()
                                    {
                                        targetFocusContainerOnTrue.MoveFocus(new TraversalRequest(FocusNavigationDirection.First));
                                    },
                                    DispatcherPriority.Input,
                                    null);
                            }
                            e.Handled = true;
                        }

                        // Technically one needs to change active key tip scope,
                        // but since we do not have public api to do that yet,
                        // we dismiss keytips
                        KeyTipService.DismissKeyTips();
                    }
                    break;
            }
        }
예제 #7
0
 internal static void HandleDismissPopup(
     RibbonDismissPopupEventArgs e,
     Action<bool> setter,
     Predicate<DependencyObject> cancelPredicate,
     UIElement mouseOverTarget,
     UIElement alternateMouseOverTarget)
 {
     if (!cancelPredicate(e.OriginalSource as DependencyObject))
     {
         // Call setter if the dismiss mode is always or
         // if the mouse is not directly over either of
         // the targets.
         if (e.DismissMode == RibbonDismissPopupMode.Always ||
             (!IsMousePhysicallyOver(mouseOverTarget) &&
             !IsMousePhysicallyOver(alternateMouseOverTarget)))
         {
             setter(false);
         }
         else
         {
             e.Handled = true;
         }
     }
     else
     {
         e.Handled = true;
     }
 }
예제 #8
0
 private void OnDismissPopup(RibbonDismissPopupEventArgs e)
 {
     if (e.DismissMode == RibbonDismissPopupMode.Always)
     {
         // Stop popup dismissal if the original source
         // is from FilterPane.
         ContentPresenter filterPane = FilterContentPane;
         if (filterPane != null &&
             RibbonHelper.IsAncestorOf(filterPane, e.OriginalSource as DependencyObject))
         {
             e.Handled = true;
         }
     }
 }
예제 #9
0
 private static void OnDismissPopupThunk(object sender, RibbonDismissPopupEventArgs e)
 {
     RibbonGallery ribbonGallery = (RibbonGallery)sender;
     ribbonGallery.OnDismissPopup(e);
 }
예제 #10
0
 private static void OnDismissPopupThunk(object sender, RibbonDismissPopupEventArgs e)
 {
     RibbonMenuButton ribbonMenuButton = (RibbonMenuButton)sender;
     ribbonMenuButton.OnDismissPopup(e);
 }
예제 #11
0
 protected virtual void OnDismissPopup(RibbonDismissPopupEventArgs e)
 {
     UIElement popupChild = _popup.TryGetChild();
     RibbonHelper.HandleDismissPopup(e,
         delegate(bool value) { IsDropDownOpen = value; },
         delegate(DependencyObject d) { return d == _partToggleButton; },
         popupChild,
         this);
 }
예제 #12
0
        internal virtual void OnDismissPopup(RibbonDismissPopupEventArgs e)
        {
            // For a RibbonSplitMenuItem we will receive a DismissPopup notification
            // when the header is clicked. We need to handle that event and render
            // the operation cancelled in the StaysOpenOnClick scenario so that the
            // Popups further up th chain aren't dismissed.

            UIElement popupChild = _popup.TryGetChild();
            RibbonHelper.HandleDismissPopup(e,
                delegate(bool value) { IsSubmenuOpen = value; },
                delegate(DependencyObject d) { return StaysOpenOnClick && e.DismissMode == RibbonDismissPopupMode.Always; },
                popupChild,
                this);
        }
예제 #13
0
 private static void OnDismissPopupThunk(object sender, RibbonDismissPopupEventArgs e)
 {
     RibbonMenuItem ribbonMenuItem = (RibbonMenuItem)sender;
     ribbonMenuItem.OnDismissPopup(e);
 }
 internal override void OnDismissPopup(RibbonDismissPopupEventArgs e)
 {
     if (e.OriginalSource == _partArrowButton)
     {
         // Clicking on Arrow should not dismiss the parent popup
         e.Handled = true;
         return;
     }
     base.OnDismissPopup(e);
 }