GetToolTip() public static method

public static GetToolTip ( [ element ) : object
element [
return object
Example #1
0
        void SuggestedToolTipChanged(object newContent)
        {
            var  potentialString   = newContent;
            bool stringableToolTip = potentialString is string;

            object newToolTipContent = null;

            if (stringableToolTip)
            {
                newToolTipContent = newContent;
            }

            // Both customer and NavigationViewItem can update ToolTipContent by ToolTipService.SetToolTip or XAML
            // If the ToolTipContent is not the same as m_suggestedToolTipContent, then it's set by customer.
            // Customer's ToolTip take high priority, and we never override Customer's ToolTip.
            var toolTipContent    = ToolTipService.GetToolTip(this);
            var oldToolTipContent = m_suggestedToolTipContent;

            if (oldToolTipContent != null)
            {
                if (oldToolTipContent == toolTipContent)
                {
                    ToolTipService.SetToolTip(this, null);
                }
            }

            m_suggestedToolTipContent = newToolTipContent;
        }
Example #2
0
        internal static void BindToDescriptionPropertiesIfUnset(
            XamlUICommand uiCommand,
            FrameworkElement target)
        {
            string localHelpText = AutomationProperties.GetHelpText(target);

            if (localHelpText == null || string.IsNullOrEmpty(localHelpText))
            {
                target.SetBinding(AutomationProperties.HelpTextProperty, new Binding {
                    Path = "Description", Source = uiCommand
                });
            }

            object localToolTipAsI;

            localToolTipAsI = ToolTipService.GetToolTip(target);

            string  localToolTipAsString = null;
            ToolTip localToolTip         = null;

            if (localToolTipAsI != null)
            {
                localToolTipAsString = localToolTipAsI.ToString();
                localToolTip         = localToolTipAsI as ToolTip;
            }

            if ((localToolTipAsString == null || string.IsNullOrEmpty(localToolTipAsString)) && localToolTip == null)
            {
                target.SetBinding(ToolTipService.ToolTipProperty, new Binding {
                    Path = "Description", Source = uiCommand
                });
            }
        }
Example #3
0
        void UpdateNavigationViewItemToolTip()
        {
            var toolTipContent = ToolTipService.GetToolTip(this);

            // no custom tooltip, then use suggested tooltip
            if (toolTipContent == null || toolTipContent == m_suggestedToolTipContent)
            {
                if (ShouldEnableToolTip())
                {
                    ToolTipService.SetToolTip(this, m_suggestedToolTipContent);
                }
                else
                {
                    ToolTipService.SetToolTip(this, null);
                }
            }
        }