Not
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
This example shows how to define a tooltip control for a TextBox element.
Example
The following example shows how to define a tooltip by assigning text to the ToolTip property.
<TextBox HorizontalAlignment="Left">TextBox with ToolTip
<TextBox.ToolTip>
<TextBlock>Useful information goes here.</TextBlock>
</TextBox.ToolTip>
</TextBox>
The following example shows how to define a tooltip by assigning a ToolTip object to the ToolTip property.
<TextBox HorizontalAlignment="Left">ToolTip with non-text content
<TextBox.ToolTip>
<ToolTip>
<DockPanel Width="50" Height="70">
<Image Source="data\flower.jpg"/>
<TextBlock>Useful information goes here.</TextBlock>
</DockPanel>
</ToolTip>
</TextBox.ToolTip>
</TextBox>
The following example uses code to generate a ToolTip object. The example creates a ToolTip (tt) and associates it with a Button.
button = New Button()
button.Content = "Hover over me."
tt = New ToolTip()
tt.Content = "Created with Visual Basic"
button.ToolTip = tt
cv2.Children.Add(button)
button = new Button();
button.Content = "Hover over me.";
tt = new ToolTip();
tt.Content = "Created with C#";
button.ToolTip = tt;
cv2.Children.Add(button);
See Also
Tasks
How to: Enable a ContextMenu on a Disabled Control