Ejemplo n.º 1
0
 private void ToolTipBeacon_Loaded(object sender, RoutedEventArgs e)
 {
     showTimer.Tick     += ShowTimer_Tick;
     hideTimer.Tick     += HideTimer_Tick;
     stayOpenTimer.Tick += StayOpenTimer_Tick;
     if (TemplatedParent as FrameworkElement != null && Target == null)
     {
         Target = TemplatedParent as FrameworkElement;
     }
     overlayHost = OverlayHost.GetOverlay();
 }
Ejemplo n.º 2
0
        private Rect GetTargetRect()
        {
            OverlayHost host = OverlayHost.GetOverlay();

            if (host == null || Target == null)
            {
                return(default(Rect));
            }
            Point leftTopCornerPoint = Target.TranslatePoint(new Point(0, 0), host);
            Rect  result             = new Rect(leftTopCornerPoint, new Size(Target.ActualWidth, Target.ActualHeight));

            return(result);
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
        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();
            }
        }