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

Task ID in ToolTipTextNeeded

1 Answer 77 Views
GanttView
This is a migrated thread and some comments may be shown as answers.
konrad
Top achievements
Rank 1
konrad asked on 07 Jul 2016, 09:26 AM

I need to show something different that Text in ToolTip.

How to get other property like Id, Start, End etc (binded row)... connected with GanttViewTaskElement?

 

private void GanttView_ToolTipTextNeeded(object sender, ToolTipTextNeededEventArgs e)
{
  if(sender.GetType() == typeof(Telerik.WinControls.UI.GanttViewTaskElement))
  {
    var task = (Telerik.WinControls.UI.GanttViewTaskElement)sender;
    //e.ToolTipText = task.Id.Text.ToString();
  }
}

 

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 07 Jul 2016, 09:56 AM
Hello Dominik,

Thank you for writing.

In order to achieve the desired result, you would need to work with the parent item element keeping reference to the data object: 
private void radGanttView1_ToolTipTextNeeded(object sender, Telerik.WinControls.ToolTipTextNeededEventArgs e)
{
    GanttViewTaskElement taskElement = sender as GanttViewTaskElement;
    if (taskElement != null)
    {
        GanttGraphicalViewBaseItemElement itemElement = taskElement.Parent as GanttGraphicalViewBaseItemElement;
        if (itemElement != null)
        {
            e.ToolTipText = itemElement.Data.Index + " | " + itemElement.Data.Start.ToShortDateString() +
                " | " + itemElement.Data.Title + " | " + itemElement.Data.End.ToShortDateString();
        }
 
    }
}

I hope this helps. Should you have  further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms. For more information check out this blog post and share your thoughts.
Tags
GanttView
Asked by
konrad
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or