ToolTip for Column Header

8 posts, 0 answers
  1. Peter
    Peter avatar
    12 posts
    Member since:
    May 2010

    Posted 20 Dec 2010 Link to this post

    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
  2. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 21 Dec 2010 Link to this post

    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
  3. Peter
    Peter avatar
    12 posts
    Member since:
    May 2010

    Posted 22 Dec 2010 Link to this post

    Hi Vanya
    Thanks for your help! This is working.
    Peter
  4. Julien
    Julien avatar
    9 posts
    Member since:
    Oct 2011

    Posted 10 Aug 2012 Link to this post

    Hi,

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


    Thanks,

    Julien.
  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 13 Aug 2012 Link to this post

    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.

  6. Julien
    Julien avatar
    9 posts
    Member since:
    Oct 2011

    Posted 13 Aug 2012 Link to this post

    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.
  7. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 16 Aug 2012 Link to this post

    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.

  8. IT
    IT avatar
    3 posts
    Member since:
    Jul 2014

    Posted 22 Jan 2015 in reply to Maya Link to this post

    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> 







Back to Top