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

Remove focussed date selection on RadCalender

7 Answers 335 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Rajeev
Top achievements
Rank 1
Rajeev asked on 10 Apr 2008, 04:09 AM
Hi,

I have 2 RadCalender on my window form just llike Microsoft Outlook which will show selection of date on Top Calender and Bottom calender don't have any selection. But my Bottom calender on my form has selection and tried to remove it but no success. If i don't set focusdate or selected date on bottom calender, it takes either default value set at design time or default Jan 1900. I want same behaviour as in Microsoft Outlook. Please help.

7 Answers, 1 is accepted

Sort by
0
Boyko Markov
Telerik team
answered on 11 Apr 2008, 02:51 PM
Hello Rajeev,

You can use the SelectedDate or SelectedDates collection if you want to do some custom behavior with the selection in RadCalendar.  There are some properties such as AllowSelect, AllowMultipleSelect which could be of help.  

You can also iterate through all of the cells in RadCalendar and set the cell's Selected property to false.This will cause the deletion of any visual selection state in RadCalendar. Also, you can call the InvalidateCalendar method of RadCalendar to refresh all its states to the values set.

To iterate through the cells you can use:

foreach (CalendarCellElement cell in radCalendar1.RootElement.Children[0].Children[0].Children[2].Children[0].Children[1].Children)
{
CalendarCellElement cl = cell as CalendarCellElement;

d.Selected = false;
}


I hope this helps. Please contact me if you need more information.

Best wishes,

Boyko Markov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Charlie
Top achievements
Rank 1
answered on 30 May 2008, 05:58 AM
Hi, I'm trying to de-select "today" in a RadCalendar. Looking for RadControls' equivalent of visual studio's MonthCalendar.ShowTodayCircle. Iterating through the elements didn't work for me.

I'm using Q1 2008; not using SP1 coz it broke one of my grids

Thanks,

Charlie
0
Boyko Markov
Telerik team
answered on 30 May 2008, 02:10 PM
Hi Charlie,

Thank you for contacting us.

I can suggest the following:

1. Subscribe to the ElementRender event of RadCalendar            

this.radCalendar1.ElementRender += new Telerik.WinControls.UI.RenderElementEventHandler(radCalendar1_ElementRender);

2. In the EventHandler of this event, please include the following code:                                                                                              

void radCalendar1_ElementRender(object sender, Telerik.WinControls.UI.RenderElementEventArgs e)
        {
            if (e.Element as CalendarCellElement != null)
            {
                (e.Element as CalendarCellElement).Today = false;
            }
        }

I hope this helps. If you need more information please write me back.

Best wishes,
Boyko Markov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Charlie
Top achievements
Rank 1
answered on 02 Jun 2008, 02:06 AM
Hi again. Thanks for the reply.

The solution you gave worked for the current month, but if you navigate to the previous month, "today" would still be highlighted and in a different way. Sort of like a negative highlight if that makes sense.

Charlie
0
Boyko Markov
Telerik team
answered on 05 Jun 2008, 02:25 PM
Hi Charlie,

I've tested the behavior I have sent you only with the default theme of RadCalendar.  After your response, I've tried it with the other themes too. If there is a special coloring for the other months' days, you can use the following:

   void radCalendar1_ElementRender(object sender, Telerik.WinControls.UI.RenderElementEventArgs e)
        {
            if (e.Element as CalendarCellElement != null)
            {
                (e.Element as CalendarCellElement).Today = false;
                (e.Element as CalendarCellElement).OtherMonth = false;
            }
        }

As you can see, the CalendarCellElement class has a special behavior in different situations depending on selection, today's date, other month date, etc.

I hope this helps.

Greetings,
Boyko Markov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Charlie
Top achievements
Rank 1
answered on 06 Jun 2008, 12:16 AM
Oh right, forgot to mention I was using the Office2007Black theme. I ended up turning off the ShowOtherMonthsDays in the designer; gets rid of the problem.

I tried your solution and it actually shows other month's days like this month's, probably something in the theme. Thanks for your help.

Charlie
0
Boyko Markov
Telerik team
answered on 06 Jun 2008, 08:19 AM
Hi Charlie,

I'm happy to hear that.

Indeed, it will show the other month's day as the month's when we set the OtherMonth property to false.
Another solution was to hide the other month's days, but I thought that you will need them.

Anyway, if you have any further questions on RadCalendar, do not hesitate to write me back.

Kind regards,
Boyko Markov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Rajeev
Top achievements
Rank 1
Answers by
Boyko Markov
Telerik team
Charlie
Top achievements
Rank 1
Share this question
or