Friday, December 9, 2011

WPF XAML example: Rich texted ToolTip with italic, color and more...

Example
In this example I'll demonstrate how to add a ToolTip to a TextBox.
The ToolTip should be colored and italic.

Code snippet

Code Snippet
  1. <TextBox x:Name="SampleText"
  2.     TextWrapping="Wrap">
  3.     
  4.     <TextBox.ToolTip>
  5.         <TextBlock>
  6.             <Italic Foreground="Red">Instructions: </Italic> Type here to change the preview text.
  7.         </TextBlock>
  8.     </TextBox.ToolTip>
  9.     
  10.     The quick brown fox jumps over the lazy dog.
  11. </TextBox>


Result


Sources

No comments:

Post a Comment