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
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
Thanks for your help! This is working.
Peter
Is this problem fixed ? I was able to reproduce it in Q2 2012 SP1 version.
Thanks,
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 ?
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
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.
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.
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
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>
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.