Exemple #1
0
 private static void OnFindToolTip(object sender, FindToolTipEventArgs e)
 {
     if (e.TargetElement == null)
     {
         DependencyObject o = sender as DependencyObject;
         if (o != null)
         {
             // For keyboard shortcut we don't want to stop looking for the tooltip, even if it was the last one we showed, we still want to re-show it.
             if (e.TriggerAction != ToolTip.ToolTipTrigger.KeyboardShortcut && PopupControlService.Current.StopLookingForToolTip(o))
             {
                 // Stop looking
                 e.Handled           = true;
                 e.KeepCurrentActive = true;
             }
             else
             {
                 if (ToolTipIsEnabled(o, e.TriggerAction))
                 {
                     // Store for later
                     e.TargetElement = o;
                     e.Handled       = true;
                 }
             }
         }
     }
 }
Exemple #2
0
        /// <summary>
        ///     Finds the nearest element with an enabled tooltip.
        /// </summary>
        /// <param name="o">
        ///     The most "leaf" element to start looking at.
        ///     This element will be replaced with the element that
        ///     contains an active tooltip OR null if the element
        ///     is already in play.
        /// </param>
        /// <param name="triggerAction">
        ///     The user action that triggered this search.
        /// </param>
        /// <param name="showToolTip">
        ///     Whether or not the tooltip found should be shown.
        /// </param>
        /// <returns>True if a tooltip was located.</returns>
        private bool LocateNearestToolTip(ref DependencyObject o, ToolTip.ToolTipTrigger triggerAction, ref bool showToolTip)
        {
            IInputElement element      = o as IInputElement;
            bool          foundToolTip = false;

            showToolTip = false;

            if (element != null)
            {
                FindToolTipEventArgs args = new FindToolTipEventArgs(triggerAction);
                element.RaiseEvent(args);

                foundToolTip = args.Handled;

                if (args.TargetElement != null)
                {
                    // Open this element's ToolTip
                    o           = args.TargetElement;
                    showToolTip = true;
                }
                else if (args.KeepCurrentActive)
                {
                    // Keep the current ToolTip active
                    o           = null;
                    showToolTip = true;
                }
            }

            // Close any existing ToolTips
            return(foundToolTip);
        }
        /// <summary>
        ///     Finds the nearest element with an enabled tooltip.
        /// </summary>
        /// <param name="o">
        ///     The most "leaf" element to start looking at.
        ///     This element will be replaced with the element that
        ///     contains an active tooltip OR null if the element
        ///     is already in play.
        /// </param>
        /// <returns>True if there is an active tooltip in play.</returns>
        private bool LocateNearestToolTip(ref DependencyObject o)
        {
            IInputElement element = o as IInputElement;

            if (element != null)
            {
                FindToolTipEventArgs args = new FindToolTipEventArgs();
                element.RaiseEvent(args);

                if (args.TargetElement != null)
                {
                    // Open this element's ToolTip
                    o = args.TargetElement;
                    return(true);
                }
                else if (args.KeepCurrentActive)
                {
                    // Keep the current ToolTip active
                    o = null;
                    return(true);
                }
            }

            // Close any existing ToolTips
            return(false);
        }
 private static void OnFindToolTip(object sender, FindToolTipEventArgs e)
 {
     if (e.TargetElement == null)
     {
         DependencyObject o = sender as DependencyObject;
         if (o != null)
         {
             if (PopupControlService.Current.StopLookingForToolTip(o))
             {
                 // Stop looking
                 e.Handled           = true;
                 e.KeepCurrentActive = true;
             }
             else
             {
                 if (ToolTipIsEnabled(o))
                 {
                     // Store for later
                     e.TargetElement = o;
                     e.Handled       = true;
                 }
             }
         }
     }
 }
Exemple #5
0
 private static void OnFindToolTip(object sender, FindToolTipEventArgs e)
 {
     if (e.TargetElement == null)
     {
         DependencyObject o = sender as DependencyObject;
         if (o != null)
         {
             if (ToolTipIsEnabled(o, e.TriggerAction))
             {
                 // Store for later
                 e.TargetElement = o;
                 e.Handled       = true;
             }
         }
     }
 }
Exemple #6
0
        private bool LocateNearestToolTip(ref DependencyObject o)
        {
            IInputElement inputElement = o as IInputElement;

            if (inputElement != null)
            {
                FindToolTipEventArgs findToolTipEventArgs = new FindToolTipEventArgs();
                inputElement.RaiseEvent(findToolTipEventArgs);
                if (findToolTipEventArgs.TargetElement != null)
                {
                    o = findToolTipEventArgs.TargetElement;
                    return(true);
                }
                if (findToolTipEventArgs.KeepCurrentActive)
                {
                    o = null;
                    return(true);
                }
            }
            return(false);
        }
 // Token: 0x060058B6 RID: 22710 RVA: 0x00188D94 File Offset: 0x00186F94
 private static void OnFindToolTip(object sender, FindToolTipEventArgs e)
 {
     if (e.TargetElement == null)
     {
         DependencyObject dependencyObject = sender as DependencyObject;
         if (dependencyObject != null)
         {
             if (e.TriggerAction != ToolTip.ToolTipTrigger.KeyboardShortcut && PopupControlService.Current.StopLookingForToolTip(dependencyObject))
             {
                 e.Handled           = true;
                 e.KeepCurrentActive = true;
                 return;
             }
             if (ToolTipService.ToolTipIsEnabled(dependencyObject, e.TriggerAction))
             {
                 e.TargetElement = dependencyObject;
                 e.Handled       = true;
             }
         }
     }
 }
Exemple #8
0
        // Token: 0x060053DC RID: 21468 RVA: 0x00173DD8 File Offset: 0x00171FD8
        private bool LocateNearestToolTip(ref DependencyObject o, ToolTip.ToolTipTrigger triggerAction, ref bool showToolTip)
        {
            IInputElement inputElement = o as IInputElement;
            bool          result       = false;

            showToolTip = false;
            if (inputElement != null)
            {
                FindToolTipEventArgs findToolTipEventArgs = new FindToolTipEventArgs(triggerAction);
                inputElement.RaiseEvent(findToolTipEventArgs);
                result = findToolTipEventArgs.Handled;
                if (findToolTipEventArgs.TargetElement != null)
                {
                    o           = findToolTipEventArgs.TargetElement;
                    showToolTip = true;
                }
                else if (findToolTipEventArgs.KeepCurrentActive)
                {
                    o           = null;
                    showToolTip = true;
                }
            }
            return(result);
        }
Exemple #9
0
 private static void OnFindToolTip(object sender, FindToolTipEventArgs e)
 {
     if (e.TargetElement == null)
     { 
         DependencyObject o = sender as DependencyObject;
         if (o != null) 
         { 
             if (PopupControlService.Current.StopLookingForToolTip(o))
             { 
                 // Stop looking
                 e.Handled = true;
                 e.KeepCurrentActive = true;
             } 
             else
             { 
                 if (ToolTipIsEnabled(o)) 
                 {
                     // Store for later 
                     e.TargetElement = o;
                     e.Handled = true;
                 }
             } 
         }
     } 
 } 
Exemple #10
0
        /// <summary>
        ///     Finds the nearest element with an enabled tooltip.
        /// </summary>
        /// <param name="o">
        ///     The most "leaf" element to start looking at.
        ///     This element will be replaced with the element that
        ///     contains an active tooltip OR null if the element
        ///     is already in play.
        /// </param>
        /// <returns>True if there is an active tooltip in play.</returns>
        private bool LocateNearestToolTip(ref DependencyObject o)
        {
            IInputElement element = o as IInputElement;
            if (element != null)
            {
                FindToolTipEventArgs args = new FindToolTipEventArgs();
                element.RaiseEvent(args);

                if (args.TargetElement != null)
                {
                    // Open this element's ToolTip
                    o = args.TargetElement;
                    return true;
                }
                else if (args.KeepCurrentActive)
                {
                    // Keep the current ToolTip active
                    o = null;
                    return true;
                }
            }

            // Close any existing ToolTips
            return false;
        }