private void HideToolTip() { StopTimers(); if (tooltipPresenter == null) { return; } OverlayHost overlay = OverlayHost.GetOverlay(); if (overlay != null) { overlay.HideContent(GetToolTipContent(Target)); overlayHost.OwnerWindow.Deactivated += OwnerWindow_Deactivated; } tooltipPresenter.MouseLeftButtonDown -= OverlayControl_MouseLeftButtonDown; tooltipPresenter = null; }
private void ShowToolTip() { string groupName = GetInheritedGroupName(this); if (!String.IsNullOrWhiteSpace(groupName) && !IsToolTipsGroupEnabled(groupName)) { return; } overlayHost = OverlayHost.GetOverlay(); if (overlayHost != null) { overlayHost.OwnerWindow.Deactivated += OwnerWindow_Deactivated; tooltipPresenter = overlayHost.ShowContent(GetToolTipContent(Target), GetTargetRect(), GetToolTipTemplateKey(Target)); tooltipPresenter.PlacementPriority = GetPlacementPriority(Target); SetAttachedBeacon(tooltipPresenter, this); SetBinding(ToolTipHasMouseOverProperty, new Binding { Source = tooltipPresenter, Path = new PropertyPath(IsMouseOverProperty), Mode = BindingMode.OneWay }); tooltipPresenter.MouseLeftButtonDown += OverlayControl_MouseLeftButtonDown; hideTimer.Interval = TimeSpan.FromMilliseconds(GetGetHideDelay(Target)); hideTimer.Start(); } }