This would be useful, if the cell width is to small to display the whole content.
I already have this style:
<
Style
x:Key
=
"CellStyle1"
TargetType
=
"{x:Type tk:GridViewCell}"
>
<
Setter
Property
=
"ToolTip"
Value
=
"{Binding RelativeSource={RelativeSource Mode=Self}, Path=Content.Text}"
/>
</
Style
>
(I have labels as content in all my cells).
This works in principle, but I always get lots of data errors in the debug window output, because there seem to be some automatically generated cells who don't have my Label in it.
"
System.Windows.Data Error: 40 : BindingExpression path error: 'Text' property not found on 'object' ''String' (HashCode=757206908)'. BindingExpression:Path=Content.Text; DataItem='GridViewCell' (Name=''); target element is 'GridViewCell' (Name=''); target property is 'ToolTip' (type 'Object')
"
Any way to get rid of these errors?
Is there a better way to set the ToolTip of data cells to the content of cells?
Thanks
10 Answers, 1 is accepted

According to me it is better to add the tooltip to the rows using DataTemplate,see how to do that:
http://www.telerik.com/help/wpf/gridview-how-to-create-row-tooltip.html
Hope this helps!
Another possible approach that will add a ToolTip for every cell is to make a slight change into the definition of your style like follows:
<
Style
TargetType
=
"{x:Type telerik:GridViewCell}"
>
<
Setter
Property
=
"ToolTip"
Value
=
"{Binding RelativeSource={RelativeSource Mode=Self}, Path=Value}"
/>
</
Style
>
All the best,
Maya
the Telerik team

If I have a big table where I scroll around (vertically and/or horizontally), no ToolTips are shown anymore.
I end up with a behaviour that only the first and last column do show ToolTips for each cell.
I suspect that this has something to do with how GridView dynamically loads data to the view?
We will investigate the issue and we will inform you as soon as we are able to provide a proper solution. For the time being the a possible workaround is to disable the ColumnVirtualization.
Please excuse us for the inconvenience caused.
Maya
the Telerik team

<
Style
TargetType
=
"{x:Type telerik:GridViewCell}"
>
<
Setter
Property
=
"ToolTip"
Value
=
"{Binding RelativeSource={RelativeSource Mode=Self}, Path=Value}"
/>
</
Style
>
its working fine now.
Claus its working fine make sure you are doing it right. Have a look again, might be you are missing some thing.
Good Lucj
Regards

However I have a follow up question related to this. How can you have this ToolTip only display if the cell the mouse is hovering over is truncated? Otherwise it not very useful to display what is fully visible in a cell also in a tooltip.
You can try to create ToolTip template selector, verify whether the text is longer than the width of the cell for example and display the ToolTip if necessary.
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

You can check out this demo and this article for more information. You can verify what is the value of the property you want and the with of the cell for example from the arguments of the SelectTemplate method.
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
