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

Using Tooltips in RadCalendar

3 Answers 126 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Friedhelm
Top achievements
Rank 1
Friedhelm asked on 31 Jul 2012, 08:50 AM
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

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 03 Aug 2012, 06:34 AM
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 >>
0
Friedhelm
Top achievements
Rank 1
answered on 03 Aug 2012, 07:06 AM
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
0
Accepted
Peter
Telerik team
answered on 07 Aug 2012, 02:06 PM
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 >>
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Friedhelm
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Friedhelm
Top achievements
Rank 1
Peter
Telerik team
Share this question
or