WPF - DataGrid Column's ToolTip visibility based on the column's data length
- by S.C.Vidhya
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>