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

Highlighting an entire week

8 Answers 165 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Andy
Top achievements
Rank 1
Andy asked on 12 Aug 2010, 12:00 PM
Is there a way to replicate the behaviour of the Outlook calendar, where you click on an individual day and the entire week is highlighted?

I have linked the Calendar to a Scheduler control, and it displays the correct week there, but I would like to highlight the entire week in the Calendar control, rather than the single day

Thanks

8 Answers, 1 is accepted

Sort by
0
Dobry Zranchev
Telerik team
answered on 16 Aug 2010, 07:55 PM
Hello Andy,

Thank you for writing.

You could use the SpecialDays property of the calendar to highlight some day/days. Please note that you should only add the desired dates to the SpecialDays collection.

I hope this will help you. If you have other questions, do not hesitate to write us.

All the best,
Dobry Zranchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Andy
Top achievements
Rank 1
answered on 18 Aug 2010, 11:22 AM
This did not work as I wanted, but I was able to solve my problem using the ElementRender event

Thanks
0
Dobry Zranchev
Telerik team
answered on 20 Aug 2010, 03:29 PM
Hi Andy,

I am glad to hear that you have found a solution for your issue. Do not hesitate to contact us if you have further questions.

Regards,
Dobry Zranchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
hema
Top achievements
Rank 1
answered on 28 Jul 2011, 07:54 AM
Hi,
          Hi andy i have the same issue of highlighting the entire week can u please explain me how u have done with the ElementRender Event.......Please  help me in this regard..


Thanks in Advance 
Hema




  
0
Andy
Top achievements
Rank 1
answered on 28 Jul 2011, 10:25 AM
Broadly, I intercepted the event, and checked whether the selected date was in that week.
If so, change the background colour of the day element to be something other than the default.

It's been a year since I wrote it, so it's a bit vague without trying to find the source code again in our archives!
0
Ivan Todorov
Telerik team
answered on 01 Aug 2011, 02:34 PM
Hello hema,

Here is a code snippet that implements Andy's idea:
public Form1()
{
    InitializeComponent();
    this.radCalendar1.ElementRender += radCalendar1_ElementRender;
}
 
public int WeekNumber(System.DateTime value)
{
    return CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(value, CalendarWeekRule.FirstFourDayWeek,
                                                             DayOfWeek.Monday);
}
 
private void radCalendar1_ElementRender(object sender, RenderElementEventArgs e)
{
    if (WeekNumber(e.Day.Date) == WeekNumber(this.radCalendar1.SelectedDate))
    {
        e.Element.BackColor = Color.WhiteSmoke;
    }
    else
    {
        e.Element.ResetValue(LightVisualElement.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local);
    }
}

Hope this is useful.

Regards,
Ivan Todorov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
hema
Top achievements
Rank 1
answered on 02 Aug 2011, 05:40 AM
Hi,

         I have opened a support tickect and attached a sample in which i implemented  code but its not working fine......


Thanks
Hema
0
Boryana
Telerik team
answered on 04 Aug 2011, 11:49 AM
Hi Hema,

Thank you for writing back. Please find further details about your specific scenario in the support ticket you have opened.

Regards,
Boryana
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Andy
Top achievements
Rank 1
Answers by
Dobry Zranchev
Telerik team
Andy
Top achievements
Rank 1
hema
Top achievements
Rank 1
Ivan Todorov
Telerik team
Boryana
Telerik team
Share this question
or