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); }
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); }
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; } }
private static void OnDismissPopupThunk(object sender, RibbonDismissPopupEventArgs e) { RibbonQuickAccessToolBar qat = (RibbonQuickAccessToolBar)sender; qat.OnDismissPopup(e); }
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; } }
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; } }
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; } } }
private static void OnDismissPopupThunk(object sender, RibbonDismissPopupEventArgs e) { RibbonGallery ribbonGallery = (RibbonGallery)sender; ribbonGallery.OnDismissPopup(e); }
private static void OnDismissPopupThunk(object sender, RibbonDismissPopupEventArgs e) { RibbonMenuButton ribbonMenuButton = (RibbonMenuButton)sender; ribbonMenuButton.OnDismissPopup(e); }
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); }
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); }
private static void OnDismissPopupThunk(object sender, RibbonDismissPopupEventArgs e) { RibbonMenuItem ribbonMenuItem = (RibbonMenuItem)sender; ribbonMenuItem.OnDismissPopup(e); }