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

ToolTip for Column Header

8 Answers 373 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 20 Dec 2010, 09:51 AM
Hello

I need some ToolTips for the column headers in a RadGridView. I specified the following:
<telerik:RadGridView.Resources>
    <Style TargetType ="{x:Type telerik:GridViewHeaderCell}">
        <Setter Property="ToolTip" Value="{Binding Content, RelativeSource={RelativeSource Self}}"/>
    </Style>
</telerik:RadGridView.Resources>

and for th column:
<telerik:GridViewDataColumn Header="Type"  DataMemberBinding="{Binding Path=DriveType}" ToolTip="Drive Type" />

As soon as i hover over the column header, the app crashes with:
    "Specified element is already the logical child of another element. Disconnect it first."
I get the same result if i put the style into the Window.Resources.
What do i have to do?

Thanks for help
Peter

8 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 21 Dec 2010, 05:10 PM
Hi Peter,

Probably it is a bug and we need more time to investigate it.

In the meantime you can define the Header by yourself and set the tooltip directly:

<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" >
    <telerik:GridViewDataColumn.Header>
        <TextBlock Text="Name" ToolTip="Name tooltip" />
    </telerik:GridViewDataColumn.Header>
</telerik:GridViewDataColumn>

This is working.

All the best,
Vanya Pavlova
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Peter
Top achievements
Rank 1
answered on 22 Dec 2010, 09:33 AM
Hi Vanya
Thanks for your help! This is working.
Peter
0
Julien
Top achievements
Rank 1
answered on 10 Aug 2012, 02:33 PM
Hi,

Is this problem fixed ? I was able to reproduce it in Q2 2012 SP1 version.


Thanks,

Julien.
0
Maya
Telerik team
answered on 13 Aug 2012, 02:11 PM
Hello Julien,

Will it be possible to share a bit more details about your exact scenario ? What is the reason you want to define a ToolTip both in the column level and as a resource ?  


Kind regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Julien
Top achievements
Rank 1
answered on 13 Aug 2012, 02:16 PM
Hi Maya,

Thank you for your answer.
I'm trying to do exactly the same thing explained in the first post:

<telerik:RadGridView.Resources>
    <Style TargetType ="{x:Type telerik:GridViewHeaderCell}">
        <Setter Property="ToolTip" Value="{Binding Content, RelativeSource={RelativeSource Self}}"/>
    </Style>
</telerik:RadGridView.Resources>

and for th column:
<telerik:GridViewDataColumn Header="Type"  DataMemberBinding="{Binding Path=DriveType}" ToolTip="Drive Type" />


The work around given here works fine:

<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" >
    <telerik:GridViewDataColumn.Header>
        <TextBlock Text="Name" ToolTip="Name tooltip" />
    </telerik:GridViewDataColumn.Header>
</telerik:GridViewDataColumn>

But I would like to avoid modifying the content of the header (should remain as a string and not a textblock).

Thanks a lot,

Regards,
Julien.
0
Maya
Telerik team
answered on 16 Aug 2012, 02:04 PM
Hello Peter,

That would be a kind of expected behavior since the content of the header is visual element. Since you are trying to add it in ToolTip as well, you will get the exception that the element is already a child to another one. What you can try is to define ToolTip-s in the manner described in this forum thread.  

Kind regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
IT
Top achievements
Rank 1
answered on 22 Jan 2015, 09:28 AM
Hi,

I ran into the same issue.
I managed to get it working in a way that will only work with non-templated header columns. But then if you do use a template, you may as well set the ToolTip there.

Here's the code that Work For Me (TM):


        <Style TargetType ="{x:Type telerik:GridViewHeaderCell}">
            <Setter Property="ToolTip" Value="{Binding Content.Text, RelativeSource={RelativeSource Self}}"/>
            <Setter Property="ToolTipService.InitialShowDelay" Value="500"/>
        </Style> 







0
Stefan
Telerik team
answered on 22 Jan 2015, 11:15 AM
Hello Peter,

We are glad that you have found a resolution to this issue.

Kind  Regards,
Stefan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
GridView
Asked by
Peter
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Peter
Top achievements
Rank 1
Julien
Top achievements
Rank 1
Maya
Telerik team
IT
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or