Export (0) Print
Expand All

FrameworkElement.ToolTip Property

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

Namespace: System.Windows
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

[BindableAttribute(true)] 
[LocalizabilityAttribute(LocalizationCategory.ToolTip)] 
public Object ToolTip { get; set; }
/** @property */
public Object get_ToolTip ()

/** @property */
public void set_ToolTip (Object value)

public function get ToolTip () : Object

public function set ToolTip (value : Object)

<object>
  <object.ToolTip>
    <ToolTip .../>
  </object.ToolTip>
</object>
- or -
<object>
  <object.ToolTip>
    toolTipObjectContent
  </object.ToolTip>
</object>
<object ToolTip="toolTipContent"/>
 toolTipContent  A string that becomes the display text for the ToolTip.   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 ToolTip, 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 ContentControl.Content property. <ToolTip .../> See ToolTip. 

Property Value

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

Identifier field

ToolTipProperty

Metadata properties set to true

None

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.

The following example creates a ToolTip in code and then sets the ToolTip 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();
  Duration duration = new Duration(TimeSpan.FromSeconds(10));
  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);
} 

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft