Task ID in ToolTipTextNeeded

2 posts, 0 answers
  1. Dominik
    Dominik avatar
    61 posts
    Member since:
    Dec 2012

    Posted 07 Jul 2016 Link to this post

    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();
      }
    }

     

  2. Hristo
    Admin
    Hristo avatar
    800 posts

    Posted 07 Jul 2016 Link to this post

    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.
Back to Top