WPF - DataGrid Column's ToolTip visibility based on the column's data length
Posted
by S.C.Vidhya
on Stack Overflow
See other posts from Stack Overflow
or by S.C.Vidhya
Published on 2010-03-18T08:25:30Z
Indexed on
2010/03/18
8:31 UTC
Read the original article
Hit count: 865
In my application, i have tried to implement the visibility of tooltip based on the dataGrid Column's text length by using a converter. I am facing some problems in displaying the toolTip text.
In the ToolTip, TextBlock's text binding is not working. If its binded with some hard coded strings, it works fine.
Here below is the code that i have added for the grid column...
<Custom:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Text}">
<TextBlock.ToolTip>
<ToolTip
DataContext="{Binding Path=PlacementTarget, RelativeSource={x:Static RelativeSource.Self}}"
Visibility="{Binding Converter={StaticResource ToolTipVis}}">
<TextBlock Text="{Binding Text}">
</ToolTip>
</TextBlock.ToolTip>
</TextBlock>
</DataTemplate>
</Custom:DataGridTemplateColumn.CellTemplate>
© Stack Overflow or respective owner