How to customize tooltip for silverlight control?

Posted by KentZhou on Stack Overflow See other posts from Stack Overflow or by KentZhou
Published on 2009-11-24T19:32:53Z Indexed on 2010/05/28 1:51 UTC
Read the original article Hit count: 318

SL provide ToolTipService.ToolTip for simple tooltip. I want to customize tooltip with my own user control. One way is to do something like:

<TextBlock Text="Hello"  >
  <ToolTipService.ToolTip>
     <TextBlock Text="I can help you." />  <!--replace this with user control -->
  </ToolTipService.ToolTip>
</TextBlock>

But what I want is:

1) create a style for tooltip, so that it can be set as something like

<TextBlock Text="Hello" Style="{StaticResource TextBlockWithToolTip}" >

2) Content for tooltip can be set dynamically from datacontext, such as title, content, etc.

How to implement it?

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about silverlight-3.0