/// <summary> /// Invoked when the QuickAccessToolbar's template is applied. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); if (_mainPanel != null) { _mainPanel.Children.Clear(); } if (_overflowPanel != null) { _overflowPanel.Children.Clear(); } _mainPanel = GetTemplateChild(MainPanelTemplatePartName) as RibbonQuickAccessToolBarPanel; _overflowPanel = GetTemplateChild(OverflowPanelTemplatePartName) as RibbonQuickAccessToolBarOverflowPanel; _overflowPopup = GetTemplateChild(OverflowPopupTemplatePartName) as Popup; _overflowButton = GetTemplateChild(OverflowButtonTemplatePartName) as RibbonToggleButton; if (_overflowButton != null) { _overflowButton.ToolTipTitle = _overflowButtonToolTipText; } // Set KeyTipAutoGenerationElements property on self. IEnumerable <DependencyObject> keyTipAutoGenerationElements = new KeyTipAutoGenerationElements(this); KeyTipService.SetKeyTipAutoGenerationElements(this, keyTipAutoGenerationElements); if (_overflowPanel != null) { // Set KeyTipAutoGenerationElements property on overflow panel which helps // auto generation of keytips on elements of overflow. KeyTipService.SetKeyTipAutoGenerationElements(_overflowPanel, keyTipAutoGenerationElements); } }
private void InvalidateLayout() { InvalidateMeasure(); RibbonQuickAccessToolBarPanel toolBarPanel = this.MainPanel; if (toolBarPanel != null) { toolBarPanel.InvalidateMeasure(); } }