Skip to main content
 

Gets or sets the tool-tip object that is displayed for this element in the user interface (UI).

Namespace:   System.Windows
Assembly:  PresentationFramework (in PresentationFramework.dll)

[BindableAttribute(true)]
[LocalizabilityAttribute(LocalizationCategory.ToolTip)]
public object ToolTip { get; set; }
public:
[BindableAttribute(true)]
[LocalizabilityAttribute(LocalizationCategory::ToolTip)]
property Object^ ToolTip {
	Object^ get();
	void set(Object^ value);
}
[<BindableAttribute(true)>]
[<LocalizabilityAttribute(LocalizationCategory.ToolTip)>]
member ToolTip : Object with get, set
<BindableAttribute(True)>
<LocalizabilityAttribute(LocalizationCategory.ToolTip)>
Public Property ToolTip As Object

Property Value

Type:

The tooltip object. See Remarks below for details on why this parameter is not strongly typed.

If the value of this property is of type ToolTip, then that value is the tool-tip that will be used in the UI. If the value is of any other type, then that value will be used as the content for a ToolTip provided (constructed) by the system. For more information, see ToolTipService. The service class provides attached properties that can be used to further customize a ToolTip.

<object ToolTip="toolTipContent"/>
<object>
  <object.ToolTip>
    <ToolTip .../>
  </object.ToolTip>
</object>
- or -
<object>
  <object.ToolTip>
    toolTipObjectContent
  </object.ToolTip>
</object>
toolTipContent

A string that becomes the display text for the .

toolTipObjectContent

Some object, provided in object element form, that should be used as the content for the FrameworkElement . Typically this would be a FrameworkElement or some other element that creates layout compositing for the , eventually containing text content within the compositing. In this usage, the ToolTip element is created implicitly from the parsed XAML, and the toolTipObjectContent content is set as its property.

<ToolTip .../>

See ToolTip.

Identifier field

ToolTipProperty

Metadata properties set to true

None

The following example creates a ToolTip in code and then sets the property on a StatusBar control.

private void MakeProgressBar(object sender, RoutedEventArgs e)
{
    sbar.Items.Clear();
    TextBlock txtb = new TextBlock();
    txtb.Text = "Progress of download.";
    sbar.Items.Add(txtb);
    ProgressBar progressbar = new ProgressBar();
    progressbar.Width = 100;
    progressbar.Height = 20;
    Duration duration = new Duration(TimeSpan.FromSeconds(5));
    DoubleAnimation doubleanimation =
                               new DoubleAnimation(100.0, duration);
    progressbar.BeginAnimation(ProgressBar.ValueProperty,
                               doubleanimation);
    ToolTip ttprogbar = new ToolTip();
    ttprogbar.Content = "Shows the progress of a download.";
    progressbar.ToolTip = (ttprogbar);
    sbar.Items.Add(progressbar);
}
Private Sub MakeProgressBar(ByVal sender As Object, ByVal e As RoutedEventArgs)
	sbar.Items.Clear()
	Dim txtb As New TextBlock()
	txtb.Text = "Progress of download."
	sbar.Items.Add(txtb)
	Dim progressbar As New ProgressBar()
	progressbar.Width = 100
	progressbar.Height = 20
	Dim duration As New Duration(TimeSpan.FromSeconds(5))
	Dim doubleanimation As New DoubleAnimation(100.0, duration)
	progressbar.BeginAnimation(ProgressBar.ValueProperty, doubleanimation)
	Dim ttprogbar As New ToolTip()
	ttprogbar.Content = "Shows the progress of a download."
	progressbar.ToolTip = (ttprogbar)
	sbar.Items.Add(progressbar)
End Sub
.NET Framework
Available since 3.0
Return to top