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

Tooltips dissapears after changeing cell

4 Answers 120 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kristjan Einarsson
Top achievements
Rank 1
Kristjan Einarsson asked on 18 Mar 2011, 11:48 AM
Hi is there a fault in the tooltips for the gridview/treelistview ?

Whenever I change the value of the cell the tooltip for the cell becomes null, the fault is also in your example
home->controls->data->gridview->datatemplateselectors->cell tooltips.

This is my code
private void grid_CellLoaded(object sender, CellEventArgs e)
{
    ToolTip tip = new ToolTip();
    tip.Content = "hello world";
    //e.Cell.ToolTip = tip; -> I've tryed this and the line below.
    ToolTipService.SetToolTip(e.Cell, tip);
}

I'm using the newest version of the telerik dll's.
Is there any fix or workaround ?

Best regards
Kristján.

4 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 18 Mar 2011, 02:24 PM
Hi Kristjan Einarsson,

You may define the ToolTip as follows:

<Window.Resources>     
        <Style TargetType="{x:Type telerik:GridViewCell}">
            <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Value, Mode=TwoWay}"/>
        </Style>
</Window.Resources>

 

Best wishes,
Maya
the Telerik team
0
Kristjan Einarsson
Top achievements
Rank 1
answered on 18 Mar 2011, 03:39 PM
Hi Maya,

My grid definition is something like this
--|--|--|--|--|--|--|--|--|--|
x |x |x |y |y |y |y |y |y |y |
(where the x are none dynamic columns and the y are dynamic columns)

and my tooltip should not display the original value of the cell.
I followed the codebehind example from this article
So my question is it possible to do this in codebehind without the disappearing problems ?

Best regards
Kristján.
0
Maya
Telerik team
answered on 21 Mar 2011, 10:46 AM
Hello Kristjan Einarsson,

In this case you may handle the RowEditEnded event for example and perform the exact same logic as the one in the RowLoaded event. Thus even after changing the value in a particular row, the ToolTip will be displayed correctly.
  

Greetings,
Maya
the Telerik team
0
Kristjan Einarsson
Top achievements
Rank 1
answered on 24 Mar 2011, 12:07 PM
I found a solution for this
As I described earlier I use this code for setting the tooltip for cell
private void grid_CellLoaded(object sender, CellEventArgs e)
{
    ToolTip tip = new ToolTip();
    tip.Content = "My custom tooltip for each cell that should not change even if the cell value changes";
    ToolTipService.SetToolTip(e.Cell, tip);
}
 
And in the BeginningEdit event the e.cell.tooltip is not null and has the correct value.
As the CellEditEnded becomes activates the e.cell.tooltip becomes null -> in other words is the the expected behavior ?
so my solution was to copy the tooltip from the BeginningEdit event and set it again in the
end of the CellEditEnded event.

Thanks for the help
best regards
Kristján.
Tags
GridView
Asked by
Kristjan Einarsson
Top achievements
Rank 1
Answers by
Maya
Telerik team
Kristjan Einarsson
Top achievements
Rank 1
Share this question
or