This is a migrated thread and some comments may be shown as answers.

Tooltip on Column title

9 Answers 761 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Narendra
Top achievements
Rank 1
Narendra asked on 09 Aug 2010, 10:05 AM

 

 

 

Hi,

I want to define a tooltip that will shown, when mouse is over the title of the column.

Used the below code xaml for tooltip, but it is not showing tooltip.

<
telerik:GridViewDataColumn Header="First Name"

 

 

 

DataMemberBinding="{Binding FirstName}" ToolTip="First Name Tooltip" />

I am missing any thing.

Thanks,
-Narendra

 

9 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 10 Aug 2010, 08:00 AM
Hello Narendra,

Use the following code to add a tooltip to column headers:
<telerik:RadGridView Name="radGridViewHeaderCellTooltip" ItemsSource="{Binding}">
<telerik:RadGridView.Resources>
<Style TargetType ="{x:Type telerik:GridViewHeaderCell}">
<Setter Property="ToolTip" Value="{Binding Content, RelativeSource={RelativeSource Self}}"/>
</Style>                    
</telerik:RadGridView.Resources>
</telerik:RadGridView>

Kind regards,
Vanya Pavlova
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Narendra
Top achievements
Rank 1
answered on 10 Aug 2010, 08:13 AM
Thanks for the response.

Is there any other way like setting property of GridViewColumn?

0
Vanya Pavlova
Telerik team
answered on 10 Aug 2010, 12:43 PM
Hello Narendra,

Generally there is no built-in property that will set the tooltip of the header in this way,you should implement it yourself and  GridViewHeaderCellStyle  is the easiest  way to achieve this result.

All the best,
Vanya Pavlova
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
KENNETH
Top achievements
Rank 1
answered on 02 Dec 2010, 02:30 AM
I would like the grid to pick up the data annotation description as the tool tip. Is this possible?

My code looks like this:

[

 

Display(Name = Consts.DisplayName.MyColumn,Description="Tooltip goes here")]

 

0
Vanya Pavlova
Telerik team
answered on 02 Dec 2010, 09:38 AM
Hello Narendra,


Please refer to the following markup, which shows the easiest way to implement a tooltip in GridviewHeaderCell:

<UserControl.Resources
    <Style x:Key="style1" TargetType="telerik:GridViewHeaderCell">
    <Setter Property="ToolTipService.ToolTip" Value="I am a ToolTip"/>
    </Style>
</UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White">
        <telerik:RadGridView x:Name="gridView1" ShowInsertRow="True" AutoGenerateColumns="False">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="ID" HeaderCellStyle="{StaticResource style1}" DataMemberBinding="{Binding ID}"/>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </Grid>


You can create the tooltip either in xaml or in code-behind, you can bind it to the property value of your custom object and feel free to modify the code below in in the way you need.


Regards,
Vanya Pavlova
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Paul
Top achievements
Rank 1
answered on 16 Apr 2013, 03:44 PM
This xaml does indeed add a tool tip when hovering over a column header.  But, afterwards the column header goes blank.  Any ideas?
0
Paul
Top achievements
Rank 1
answered on 16 Apr 2013, 04:44 PM
...for those following the breadcrumbs, here is a telerik workaround to the column header/tooltip issue:
http://www.telerik.com/community/forums/wpf/gridview/exception-when-binding-the-tootip-of-the-headers.aspx
0
Sergey
Top achievements
Rank 1
answered on 20 May 2015, 06:07 PM

For those, still looking for solution:

<telerik:RadGridView Name="radGridViewHeaderCellTooltip" ItemsSource="{Binding}">
    <telerik:RadGridView.Resources>
        <!-- you can remove BasedOn if you don't use implicit styles -->
        <Style TargetType ="{x:Type telerik:GridViewHeaderCell}" BasedOn="{StaticResource {x:Type telerik:GridViewHeaderCell}}">
            <Setter Property="ToolTip" Value="{Binding Column.(ToolTipService.ToolTip), RelativeSource={RelativeSource Self}}"/>
        </Style>
    </telerik:RadGridView.Resources>
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Property1}" Header="Property1" ToolTip="Property 1 Tooltip" />
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Property2}" Header="Property2" ToolTip="Property 2 Tooltip" />
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

2
Sunil
Top achievements
Rank 1
answered on 07 Dec 2015, 08:29 PM

Use the following line instead. This will not make the header blank.

 <Setter Property="ToolTip" Value="{Binding Content.Text, RelativeSource={RelativeSource Self}}"></Setter>

Tags
GridView
Asked by
Narendra
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Narendra
Top achievements
Rank 1
KENNETH
Top achievements
Rank 1
Paul
Top achievements
Rank 1
Sergey
Top achievements
Rank 1
Sunil
Top achievements
Rank 1
Share this question
or