user2740190
user2740190

Reputation:

Binding Tooltip to two properties in Silverlight

Currently I have something like this and it works fine:

ToolTipService.ToolTip="{Binding PersonInfo}"

But I also have another property called PersonDetails

I want to be able to make the tooltip to show both of them and not just the first one. Something like PersonInfo + "\r\n" + PersonDetails

Where should I start from?

Upvotes: 0

Views: 110

Answers (1)

Chris W.
Chris W.

Reputation: 23270

No sweat, you didn't specify WPF or SL but the concept is the same for each. Something like this should work just fine for your requirements;

<Object>
 <ToolTipService.ToolTip>

      <TextBlock>
           <Run Text="{Binding PersonInfo}" FontWeight="Bold"/>
           <Run Text="{Binding PersonDetails}"/>
      </TextBlock>

  </ToolTipService.ToolTip>
</Object>

Which also provides you the ability to format that information you're showing in different ways and even style it up a bit if you want, like if you wanted to make part of it Bold like in the example.

Hope this helps.

Upvotes: 3

Related Questions