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

[Solved] Gridview's cell tooltip

3 Answers 346 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Navneet
Top achievements
Rank 1
Navneet asked on 19 Jan 2011, 01:14 PM
I am using silverlight RadGridview control.
In RadGridView (Silverlight grid) , i want to increase the time duration of tooltip, by default i think its 5 sec but i want to display this tooltip for
forever. when i move mouse from one cell to another cell then only tooltip is changed and display forever.

Please gives me help where should i need to write the code and which event.

3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 20 Jan 2011, 10:20 AM
Hello Navneet,

You may take a look at this forum thread for a reference.
 

Kind regards,
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Peter
Top achievements
Rank 1
answered on 22 Jan 2011, 01:10 PM
Hello Maya,

I'm facing the same problem at the moment and your link lead me only half the way to a solution. Implementing codeplex's ToolTipService gives access to the fields needed. The main problem is where to set the tooltip. I'm using GridViewDataColumns and the only property available is ToolTipTemplate which points to the ContentTemplate of a fixed ToolTip. How can I change the default ToolTip of those columns?

As soon as this information is provided it should be really easy to set the ToolTip to the custom one and get tooltips that last longer/shorter than the default ones.

Kind regards,
Hans-Peter
0
Maya
Telerik team
answered on 24 Jan 2011, 03:23 PM
Hi Hans,

You may define this ToolTip on a column as follows:

xmlns:Controls="clr-namespace:Silverlight.Controls.ToolTips;assembly=Silverlight.Controls.ToolTips"
 
<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}">
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Name}"  >                            
                                <Controls:ToolTipService.ToolTip>
                                    <Controls:ToolTip Content="{Binding Name}" DisplayTime="00:00:01" />
                                </Controls:ToolTipService.ToolTip>                             
                            </TextBlock>
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>

Another possible approach is to handle the RowLoaded event:
void playersGrid_RowLoaded(object sender, RowLoadedEventArgs e)
        {
            var row = e.Row as GridViewRow;
            var cells = row.ChildrenOfType<GridViewCell>();
            foreach (GridViewCell cell in cells)
            {
                var tooltip = new Silverlight.Controls.ToolTips.ToolTip();
                tooltip.DisplayTime = new Duration(new TimeSpan(0,0,3));
                tooltip.Content = (cell.Column as GridViewDataColumn).DataMemberBinding.Path.Path;
                cell.SetValue(Silverlight.Controls.ToolTips.ToolTipService.ToolTipProperty, tooltip);
 
            }          
        }

 

Regards,
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
GridView
Asked by
Navneet
Top achievements
Rank 1
Answers by
Maya
Telerik team
Peter
Top achievements
Rank 1
Share this question
or