简体   繁体   English

XAML等效于HTML标题属性

[英]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? 我正在开发一个小的C#WPF应用程序,我想知道xaml中是否有任何等效的html title属性,这样当鼠标悬停在按钮或元素上时,它会显示一个简短的文本,以帮助用户知道什么那个按钮呢?

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 . 取自ToolTip类

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. 这几乎适用于任何WPF控件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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