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

Calendar Special Days Properties

2 Answers 113 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
lesley
Top achievements
Rank 1
lesley asked on 25 Jul 2014, 01:04 PM
The Special Days properties are having no effect.

Disabled = true  -  Expected it to grey out the day. I get a normal, still selectable special day.
Selectable = false - Expected that when that day is clicked no selection occurs -  I get a normal, still selectable special day.
Selected = false - Expected the day not to be highlighted - I get a highlighted special day.

Toggling these properties to true or false seems to have no effect. The special day is still enabled, selectable and highlighted.

The other properties seem to function ok. Setting the date of the day, recurring and the tooltip are ok.

Am I missing a setting? misinterpreting the behaviours?

Tested using a new standard winforms application.
Controls version 2014.2.715.40

2 Answers, 1 is accepted

Sort by
0
Ralitsa
Telerik team
answered on 29 Jul 2014, 11:09 AM
Hi Lesley, 

Thank you for contacting us. 

I investigated your case and indeed setting the Disabled, Selectable or Selected properties of special day has no affect. I confirm that is an issue in our RadCalendar and have logged it in our Feedback Portal. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link - Feedback Item

Meanwhile you can use the following approaches: 

1. If you want to disable the cell, you can set the Enabled property to false. For the purpose, you can subscribe to the ElementRender event. Please take a look at the following code snippet: 

a) subsribe to the event: 
this.radCalendar1.ElementRender += radCalendar1_ElementRender;

b) set the Enabled to false 
void radCalendar1_ElementRender(object sender, RenderElementEventArgs e)
{
    if (e.Day.Date == this.radCalendar1.SpecialDays[1].Date)
    {
        e.Element.Enabled = false;
    }
    else
    {
        e.Element.ResetValue(LightVisualElement.EnabledProperty, ValueResetFlags.Local);
    }
}

2. If you want to cancel selection of specific date, you can subscribe to SelectionChanging event: 

a) subscribe to teh SelectionChanging event: 
this.radCalendar1.SelectionChanging += radCalendar1_SelectionChanging;

b) cancel the selection of special day
void radCalendar1_SelectionChanging(object sender, SelectionEventArgs e)
        {
            if (e.NewDates.Count > 0)
            {
                foreach (RadCalendarDay item in this.radCalendar1.SpecialDays)
                {
                    if (item.Date == e.NewDates[0].Date)
                    {
                        e.Cancel = true;
                    }
                }
            }
        }

You can refer to attached sample project which demonstrates you the suggested approaches. 

I have also updated your Telerik Points for reporting these cases. 

Let me know if you have any other questions.

Regards,
Ralitsa
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
lesley
Top achievements
Rank 1
answered on 30 Jul 2014, 08:48 PM
Hi Ralitsa,

Thank you for the reply. At least now I know its not my setup or installation that is a fault.

Thank you also for the code.
This works well for the project I need the Calendar for.
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
lesley
Top achievements
Rank 1
Answers by
Ralitsa
Telerik team
lesley
Top achievements
Rank 1
Share this question
or