LineBreak in a tooltip in xaml

Here’s a quick tip how to show linebreaks in a tooltip in xaml.

I wanted to show properties on multiple lines (in a multibinding):

01 '
02 <LABEL Content="{Binding Name}">
03     <LABEL.TOOLTIP>
04         <TEXTBLOCK>
05             <TEXTBLOCK.TEXT>
06                 <MULTIBINDING StringFormat="{}Code: {0}&#x0a;IP: {1}">
07                     <BINDING Path="Code" />
08                     <BINDING Path="IP" />
09                 </MULTIBINDING>
10             </TEXTBLOCK.TEXT>
11         </TEXTBLOCK>
12     </LABEL.TOOLTIP>
13 </LABEL>

This results in the following tooltip (where the mouse hovers on the text “FTP”):

posted on 2010-09-06 12:45  xqiwei  阅读(136)  评论(0编辑  收藏  举报