1

I have a Data grid and I display some data in it. I want a tooltip to be displayed if the data that I want to fit in the column of the data grid is too long. All the solutions I found use a separate class to achieve that. Is there a way to achieve the same thing with the help of a method only ?

I found the following solution in the link given.

Show WPF Tooltip if needed

<TextBlock Text="{Binding Text}">
     <TextBlock.ToolTip>
        <ToolTip 
              DataContext="{Binding Path=PlacementTarget, RelativeSource={x:Static RelativeSource.Self}}" 
                 Visibility="{Binding Converter={StaticResource toolVisConverter}}">
                 <TextBlock Text="{Binding Text}"/>  <!-- tooltip content -->
       </ToolTip>
   </TextBlock.ToolTip>

But it talks about a converter. Should I include that converter in view model or code behind file of .xaml file ?

at the same time, it says ti change the text block width in that converter. I don't know how to access Text block width in view model. I am totally new to WPF. Can someone help pls ?

Community
  • 1
  • 1
nidarshani fernando
  • 493
  • 4
  • 10
  • 26
  • http://stackoverflow.com/questions/1041820/how-can-i-determine-if-my-textblock-text-is-being-trimmed – Nacho Apr 27 '15 at 12:08

0 Answers0