Using Tooltips in RadCalendar

4 posts, 1 answers
  1. Friedhelm
    Friedhelm avatar
    9 posts
    Member since:
    Jul 2012

    Posted 31 Jul 2012 Link to this post

    I am a newby with RadControls.
    I am trying to use tooltips for the RadCalendar control in a simple Test-Form, the Properties RadCalendar.AllowTooltips and RadCalendar.ShowItemToolTips are true.

    I get tooltips, using one of the following feature:
    • private void radCalendar1_ElementRender(object sender, Telerik.WinControls.UI.RenderElementEventArgs e) 
      {
      e.Element.TooltipText = "A Tooltip";
      }
    •  
    • private void radCalendar2_ToolTipTextNeeded(object sender, Telerik.WinControls.ToolTipTextNeededEventArgs e) 
      {
        e.TooltipText = "A Tooltip";
      }
    
    
    But I don't get the following  "default" tooltips:
    • NavigationNextTooltip,...
    • SpecialDay-Tooltips by setting "SpecialDays.ToolTip" in VS Designer

  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 03 Aug 2012 Link to this post

    Hello Friedhelm,

    Thank you for writing.

    To enable tooltips in RadCalendar you should use the ToolTIpTextNeeded event of the control. To allow the tooltips to show, the ShowItemToolTips should be true (which is the default setting). Here is an example how to handle it for the available elements in RadCalendar:
    void radCalendar1_ToolTipTextNeeded(object sender, Telerik.WinControls.ToolTipTextNeededEventArgs e)
    {
        CalendarNavigationElement navElement = sender as CalendarNavigationElement;
        if (navElement != null)
        {
            e.ToolTipText = navElement.Text;
        }
     
        CalendarCellElement cell = sender as CalendarCellElement;
        if (cell != null)
        {
            if (cell.SpecialDay)
            {
                e.ToolTipText = "Special day: " + cell.Date.ToString();
            }
            else
            {
                e.ToolTipText = cell.Date.ToString();
            }
        }
     
        RadButtonElement btn = sender as RadButtonElement;
        if (btn != null)
        {
            switch (btn.Class)
            {
                case "prevButton":
                    e.ToolTipText = "Previous button";
                    break;
                case "nextButton":
                    e.ToolTipText = "Next button";
                    break;
                case "fastForwardButton":
                    e.ToolTipText = "Fast forward button";
                    break;
                case "fastBackwardButton":
                    e.ToolTipText = "Fast backward button";
                    break;
     
                default:
                    break;
            }
        }
    }

    I hope this helps. Let us know if you have any other questions.
     
    Kind regards,
    Stefan
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Friedhelm
    Friedhelm avatar
    9 posts
    Member since:
    Jul 2012

    Posted 03 Aug 2012 Link to this post

    Ok, I know this.
    But what's the purpose of the properties RadCalendar.SpecialDays[x].ToolTip, RadCalendar.NavigationNextToolTip, RadCalendar.NavigationPrevToolTip?

    For example the description of NavigationNextToolTip is:
    Gets or sets the text displayed as a tooltip for the next month navigation control.

    Best regards
    Friedhelm
  5. Answer
    Peter
    Admin
    Peter avatar
    1148 posts

    Posted 07 Aug 2012 Link to this post

    Hello Friedhelm,

    Thank you for writing back.

    The purpose of these proprties is to allow you to set the ToolTipText property for the desired elements and later in the event previously mentioned you can access the value of this property and assign it accordingly. This way you can store custom text as tooltips on per element basis. I will quote for example the source code related to these properties:
    this.prevButton.ToolTipText = this.Calendar.NavigationPrevToolTip;

    I hope this helps.

    All the best,
    Peter
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Back to Top