ToolTip for DataGrid Column

Jan 30, 2009 at 5:08 AM
I want to have a tooltip to be displayed for each column.

Any advice?

Thanks in advance.
Feb 16, 2009 at 3:14 AM
+1. It seems the DataGridColumnHeader has a Tooltip property. But the trick I think is figuring out how to bind to the property. If you sink the ColumnAdded event you don't get the header, just the Column....

Anyone have any ideas?
Feb 20, 2009 at 12:57 AM
I have one temporary solution to this is to catch DataGrid Mouse enter event and initialize each column header... just like below... may be it will help you as well..

private void OnDataGridMouseEnter(object sender, MouseEventArgs args)
            if (m_MouseEnterCount == 1)    //    Make sure it initialize only once and not every time mouse enter in DataGrid....
                DataGridColumnHeader columnHeader = DataGridHelper.GetColumnHeader(m_MyDataGrid, 0);
                columnHeader.ToolTip = "Tool tip for first column";

                columnHeader = DataGridHelper.GetColumnHeader(m_MyDataGrid, 1);
                columnHeader.ToolTip = "Tool tip for Second column";

// do the same thing for all columns.........

Feb 20, 2009 at 1:46 AM
You might have an easier time using DataGrid.ColumnHeaderStyle and setting the ToolTip property there.

Apr 7, 2009 at 11:07 AM
I would also need this functionality with the tooltips for the columns headers. But I would like to bind this ToolTip property of the CoulmnHeader but I don't know how.
Were you able to solve this problem with the tooltips?

Thanks a lot.
Apr 8, 2009 at 6:16 AM
Edited Apr 8, 2009 at 6:17 AM

Hy all.
I have done this for the style of the column:



Style x:Key="DefaultColumnHeaderStyle" TargetType="{x:Type wpfToolkit:DataGridColumnHeader}">
<Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=Column.(ToolTipService.ToolTip)}"/>

And when for binding the tooltip on the column, I do this:

dg:DataGridTextColumn Binding="{Binding Path=CountryCode}" Header="{Binding Path=lblCountry, Source={StaticResource resStaticData}, Mode=OneWay}" ToolTipService.ToolTip="{Binding Path=lblCountry, Source={StaticResource resStaticData}, Mode=OneWay}"/>







Jan 12, 2010 at 7:34 PM

this works for me

<Style  TargetType="{x:Type Custom:DataGridColumnHeader}">
     <Trigger Property="IsMouseOver" Value="True">
      <Setter Property="ToolTip" Value="{Binding Column.(ToolTipService.ToolTip), RelativeSource={RelativeSource Self}}"/>