Maybe you forgot it everytime ToolTip is more than a simple text.
Here is an example of a simple TextBlock control:
<TextBlock Text="{Binding Path=Person.NameSurname}" ToolTip="{Binding Path=Persona.LocalAddress}" />
What would you do if you want have a reacher ToolTip…person’s mobile phone number too?
Well you can’t simply have something like this π¦
<TextBlock Text="{Binding Path=Person.NameSurname}"> <TextBlock.ToolTip> <Multibinding StringFormat="{}{0} - m. {1}"> <Binding Path="Person.LocalAddress" /> <Binding Path="Person.Mobile" /> </Multibinding> </TextBlock.ToolTip> </TextBlock>
You get the error “Multibinding failed because it has no valid converter”.
Why?
Compare Text vs ToolTip MSDN page in TextBlock control …
you got it ?!?
Text is a String, ToolTip is an object, straight from FrameworkElement!
So you can define a style for it, a template, or something simpler … like this π
<TextBlock Text="{Binding Path=Person.NameSurname}"> <TextBlock.ToolTip> <TextBlock> <TextBlock.Text> <Multibinding StringFormat="{}{0} - m. {1}"> <Binding Path="Person.LocalAddress" /> <Binding Path="Person.Mobile" /> </Multibinding> </TextBlock.ToolTip> </TextBlock> </TextBlock.ToolTip> </TextBlock>
Easier, ain’t it? π
Technorati Tags: WPF,Tooltip,Multibinding,XAML.