简体   繁体   中英

XAML equivalent of the HTML Title Attribute

I am developing a small C# WPF application and I would like to know if there is any equivalent of the html title attribute in xaml so that when the mouse is hovering over a button or an element it displays a short text to help the user know what that button does?

If it doesn't exist, then how can I implement it?

Tooltips do exist. Here is an example of a complex tooltip.

<TextBox HorizontalAlignment="Left">TextBox with ToolTip
  <TextBox.ToolTip>
    <TextBlock>Useful information goes here.</TextBlock>
  </TextBox.ToolTip>
</TextBox>

Taken from ToolTip Class .

A simple text tooltip can be done like this:

<TextBox HorizontalAlignment="Left" 
         ToolTip="Useful information goes here.">TextBox with ToolTip</TextBox>

This should work for virtually any WPF control.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM