Silverlight provides a control named "tooltipservice" for the Silverlight Control
A tooltip is displayed. This class can be attached to most UI elements in Silverlight for displaying tooltip.
Simple text prompt
The following exampleCodeDisplay how to add a tooltip for a button control:
< Button Width = "60" Height = "20" Content = "My button" >
< Tooltipservice. tooltip >
< Tooltip Content = "This is tool tip for button" > </ Tooltip >
</ Tooltipservice. tooltip >
</ Button >
Show rich UI element prompt
Silverlight supports UI elements when prompted to provide a better user experience. You can enable
Use more UI elements. See the example shown below
Display images in the prompt Tool
The sample code shows how to display the image tooltip in Silverlight:
< Textbox Width = "60" Height = "20" Text = "My text" >
< Tooltipservice. tooltip >
< Image Source = "Http://www.abc.com/images/abc.jpg" >
</ Image >
</ Tooltipservice. tooltip >
</ Textbox >
Set tooltip in programming mode
You can set or change the tooltip from the background code file. The following example shows how to set the background code file as a button control.
Text tip:
Tooltipservice. settooltip (mybutton,"This is new tooltip");