public override void OnApplyTemplate() { base.OnApplyTemplate(); if (popupBtn != null) { popupBtn.PopupOpened -= OnPopupOpenend; } popupBtn = GetTemplateChild(partPopupupBtn) as RibbonDropDownButton; if (popupBtn != null) { popupBtn.PopupOpened += new RoutedEventHandler(OnPopupOpenend); } if (wrapPanel != null) { wrapPanel.Children.Clear(); } wrapPanel = GetTemplateChild(partWrapPanel) as Panel; if (wrapPanel == null) { throw new ArgumentNullException(partWrapPanel); } itemsPresenter = GetTemplateChild(partItemsPresenter) as FrameworkElement; if (wrapPanel == null) { throw new ArgumentNullException(partItemsPresenter); } AttachThumbnailsToPanel(); }
private static void Reset() { if (elements != null) { RibbonDropDownButton.CloseOpenedPopup(null); RibbonGroup.CloseOpenedPopup(); HideQuickAccessKeys(); } }
static void IsDropDownPressedPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { bool newValue = (bool)e.NewValue; RibbonDropDownButton btn = d as RibbonDropDownButton; if (newValue) { Mouse.Capture(btn, CaptureMode.SubTree); } btn.OnDropDownPressedChanged((bool)e.OldValue, (bool)e.NewValue); }
public override void OnApplyTemplate() { base.OnApplyTemplate(); appButton = GetTemplateChild(partAppButton) as RibbonDropDownButton; appButtonClone = GetTemplateChild(partAppButtonClone) as FrameworkElement; appButton.PopupOpened += new RoutedEventHandler(appButton_PopupOpened); appButton.PopupClosed += new RoutedEventHandler(appButton_PopupClosed); recentItemsList = GetTemplateChild(partRecentItemsList) as FrameworkElement; }
private static void MoveBack() { selectStack.Pop(); current = selectStack.Count > 0 ? selectStack.Pop() : null; elements = null; keySequence = ""; Keyboard.Focus(null); RibbonDropDownButton.CloseOpenedPopup(null); RibbonGroup.CloseOpenedPopup(); CloseQuickAccessKeys(); if (current != null) { ShowQuickAccessKeys(current); } }
public static void CloseOpenedPopup(RibbonDropDownButton caller) { RibbonDropDownButton btn = DroppedDownButton; if (btn != null && (btn != caller)) { FrameworkElement parent = btn.Popup != null ? btn.Popup.Child as FrameworkElement : btn; if (!parent.IsLogicalAncestorOf(caller)) { if (btn.Popup != null) { btn.Popup.IsOpen = false; } btn.IsDropDownPressed = false; } } DroppedDownButton = caller; }
private static void OnCommandPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { RibbonDropDownButton btn = (RibbonDropDownButton)d; btn.OnCommandChanged(btn, (ICommand)e.OldValue, (ICommand)e.NewValue); }