Highlighting an entire week

9 posts, 0 answers
  1. Andy
    Andy avatar
    9 posts
    Member since:
    Aug 2010

    Posted 12 Aug 2010 Link to this post

    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
  2. Dobry Zranchev
    Admin
    Dobry Zranchev avatar
    348 posts

    Posted 16 Aug 2010 Link to this post

    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
  3. Andy
    Andy avatar
    9 posts
    Member since:
    Aug 2010

    Posted 18 Aug 2010 Link to this post

    This did not work as I wanted, but I was able to solve my problem using the ElementRender event

    Thanks
  4. Dobry Zranchev
    Admin
    Dobry Zranchev avatar
    348 posts

    Posted 20 Aug 2010 Link to this post

    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
  5. hema
    hema avatar
    16 posts
    Member since:
    Mar 2011

    Posted 28 Jul 2011 Link to this post

    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




      
  6. Andy
    Andy avatar
    9 posts
    Member since:
    Aug 2010

    Posted 28 Jul 2011 Link to this post

    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!
  7. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 01 Aug 2011 Link to this post

    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!

  8. hema
    hema avatar
    16 posts
    Member since:
    Mar 2011

    Posted 02 Aug 2011 Link to this post

    Hi,

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


    Thanks
    Hema
  9. Boryana
    Admin
    Boryana avatar
    330 posts

    Posted 04 Aug 2011 Link to this post

    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 >>

Back to Top