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

6 posts, 0 answers
  1. Aavadesh
    Aavadesh avatar
    2 posts
    Member since:
    Dec 2010

    Posted 16 Dec 2010 Link to this post

    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.


  2. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 20 Dec 2010 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. Aavadesh
    Aavadesh avatar
    2 posts
    Member since:
    Dec 2010

    Posted 21 Dec 2010 Link to this post

    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.

  5. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 23 Dec 2010 Link to this post

    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
  6. sweta
    sweta avatar
    1 posts
    Member since:
    Jan 2015

    Posted 29 Jan 2015 Link to this post

    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


  7. Nasko
    Admin
    Nasko avatar
    585 posts

    Posted 30 Jan 2015 Link to this post

    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.

     
Back to Top
UI for WPF is Visual Studio 2017 Ready