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

How to set background color for selected date and multiple selected date

6 Answers 656 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Aavadesh
Top achievements
Rank 1
Aavadesh asked on 16 Dec 2010, 02:45 PM
Dear Sir,

Could you please help me with the problem as under.

How can i change color of selected date according to my wish or different colors by c# codes.

I am having dates from datebase which are the selected dates in your calender control those are displayed and selected correctly but when i selected another date excluding those date the selected dates are disappear

What I need is the newly selected data and those came from database  should be remain selected.

Currently we are using the demo version of your control if we get solution of above problem we ill buy 2 to 3 license version of your control


Thanking you,
Tabs BI Software Team.


6 Answers, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 20 Dec 2010, 10:57 AM
Hello Aavadesh,

I can suggest you setting the SelectionMode property equal to "Multiple". This approach will help you keeping the last selected dates when a new one is presented. Write us back if this is not your case.

Best wishes,
Kaloyan
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Aavadesh
Top achievements
Rank 1
answered on 21 Dec 2010, 07:08 AM

Hi Kaloyan,

I have already set my Calendar to multiple Selected Dates Mode, and it is working as per my need.

But the Problem which was in the first place that i want to change the background of the Selected Dates to different colors as per the Different Dates or the Data attached to those Dates.

i.e. For Example:- The Dates to be selected are 10th Dec, 15th Dec, and 20th Dec. Then i want the Background of the Selected Dates in the Calendar as 

10th Dec - Blue Color Background, 15th Dec - Red Color Background, and 20th Dec - Green Color Background.

Could please guide me and help me solve this Issue and if solution is there then could you please also give the code for the same. 

Thanks & Regards,

Aavadesh,

Tabs BI Software Team.

0
Kaloyan
Telerik team
answered on 23 Dec 2010, 02:11 PM
Hello Aavadesh,

I have prepared a small app with a custom implementation of the DayTemplate. Follow the code and write us back if it is not helping you.

All the best,
Kaloyan
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
sweta
Top achievements
Rank 1
answered on 29 Jan 2015, 10:06 AM
Hello,

How can i change color of selected date according to my wish or different colors by c# codes.

i select one date that change the color but if i select another date then first date not selected...

for eg. if i select 15 then it will be red but if i select 16 then 15 is deselect. 

i want multiple date selected and color also


0
Nasko
Telerik team
answered on 30 Jan 2015, 04:14 PM
Hi Sweta,

In order to achieve the desired appearance you could use the DayTemplatSelector of RadCalendar. It provides the possibility to modify the default Template of the content of each CalendarButton - you could apply different templates for the different dates using your own custom logic. However, please notice that each time you select a new date the template should be applied again. That could be achieved by using the following code:
private void RadCalendar_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    this.Calendar.DisplayDate = Calendar.DisplayDate.AddMonths(1);
    this.Calendar.DisplayDate = Calendar.DisplayDate.AddMonths(-1);
}

We have created a sample project that demonstrates the described above approach - please, check it.

We hope this will help you.

Regards,
Nasko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Manpreet
Top achievements
Rank 1
answered on 23 Apr 2019, 05:40 AM
Hi 
I am selecting a date and showing it in red color. But when i select the same date again, no color comes for it and value of date comes as 0/0/0001. I want the color of date to remain the same(i.e, red) , no matter how many times i click it.
Also if i am selecting dates outside the month, i don't want to show any color for such dates. 
Tags
Calendar
Asked by
Aavadesh
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
Aavadesh
Top achievements
Rank 1
sweta
Top achievements
Rank 1
Nasko
Telerik team
Manpreet
Top achievements
Rank 1
Share this question
or