Multiline ToolTip - Silverlight


ToolTip uses the ToolTipService.ToolTip attached property for placement, and you can use a string for this value. Multiline tooltip is not possible by default.

Neither Popup nor ToolTip content will inherit font element properties, not even from the XAML page root element. This is because the tooltip objects are displayed above the Silverlight controls when displayed. If you want to style the tooltip or to apply Multiline enabled tooltip, you need to use the TextBlock or any other control as per your requirement.

Static Way - Multiline ToolTip
  • Appending Hexadecimal Value to represent a Literal

Hexadecimal Value in slverlight

  • Including a TextBlock inside the ToolTipService tag

silverlight Hexadecimal Value
In the above example we have seen the static way of applying the MultiLine tooltip. In the hexadecimal way we need to append the characters along with the text as shown in the screen shot. In the second example we need to apply the TextWrapping properties of the TextBlock.


Dynamic Way - Multiline ToolTip
  • Appending Environment.NewLine

Hexadecimal Value
  • Appending \r and \n

Hexadecimal Value in silverlight
In the above examples we have seen the dynamic way of applying the tooltip. Either you can use the Environment.NewLine or you can use the new line character as shown in the above code.

From the above code snippets, hope you can easily implement the MultiLine tooltip in your Silverlight application.
Ebook Download
View all
Learn
View all