public RibbonTabHeaderItemsControlAutomationPeer(RibbonTabHeaderItemsControl owner) : base(owner) { }
protected virtual void OnActivatingKeyTip(ActivatingKeyTipEventArgs e) { if (e.OriginalSource == this) { e.KeyTipHorizontalPlacement = KeyTipHorizontalPlacement.KeyTipCenterAtTargetCenter; e.KeyTipVerticalPlacement = KeyTipVerticalPlacement.KeyTipCenterAtTargetCenter; e.KeyTipHorizontalOffset = e.KeyTipVerticalOffset = 0; Ribbon ribbon = Ribbon; if (ribbon != null) { RibbonTabHeaderItemsControl tabHeaderItemsControl = ribbon.RibbonTabHeaderItemsControl; if (tabHeaderItemsControl != null && tabHeaderItemsControl.IsVisible) { GeneralTransform headerToItemsControl = TransformToAncestor(tabHeaderItemsControl); if (headerToItemsControl != null) { Point tabHeaderOrigin = headerToItemsControl.Transform(new Point()); double tabHeaderCenterX = tabHeaderOrigin.X + (ActualWidth / 2); if (DoubleUtil.LessThan(tabHeaderCenterX, 0) || DoubleUtil.GreaterThan(tabHeaderCenterX, tabHeaderItemsControl.ActualWidth)) { e.KeyTipVisibility = Visibility.Hidden; } else { GeneralTransform itemsControlToRibbon = tabHeaderItemsControl.TransformToAncestor(ribbon); if (itemsControlToRibbon != null) { Point tabHeaderItemsControlOrigin = itemsControlToRibbon.Transform(new Point()); double horizontalOffset = tabHeaderCenterX + tabHeaderItemsControlOrigin.X; if (DoubleUtil.LessThan(horizontalOffset, 0) || DoubleUtil.GreaterThan(horizontalOffset, ribbon.ActualWidth)) { e.KeyTipVisibility = Visibility.Hidden; } else { // Determine the position of keytip with respect to Ribbon, // so that it does not get clipped. e.KeyTipHorizontalOffset = horizontalOffset; e.KeyTipVerticalOffset = tabHeaderItemsControlOrigin.Y + tabHeaderOrigin.Y + ActualHeight + KeyTipVerticalOffset; e.KeyTipHorizontalPlacement = KeyTipHorizontalPlacement.KeyTipCenterAtTargetLeft; e.KeyTipVerticalPlacement = KeyTipVerticalPlacement.KeyTipCenterAtTargetTop; e.PlacementTarget = ribbon; } } else { e.KeyTipVisibility = Visibility.Hidden; } } } else { e.KeyTipVisibility = Visibility.Hidden; } } } } }