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

Calendar FirstDayOfWeek issue

1 Answer 76 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Marc
Top achievements
Rank 2
Marc asked on 25 Feb 2009, 10:04 PM
I have a calendar on a form, and user settings that allow the user to change the FirstDayOfWeek setting.  When I change the FirstDayOfWeek value at runtime the day headers update correctly, but the arrangement of the actual dates are not updated.
I have tried..

radCal.FirstDayOfWeek = FirstDayOfWeek.Monday
radCal.InvalidateCalendar
radCal.refresh

None of this works.

How do I force the Calendar to update correctly after a FirstDayOfWeek change?

I am using your latest version and VB.net in VS 2008.

Thank you.

1 Answer, 1 is accepted

Sort by
0
Accepted
Boyko Markov
Telerik team
answered on 02 Mar 2009, 04:10 PM
Hi Marc,

I confirm the faulty behavior - your Telerik Points have been updated for the bug report. We will do our best to fix this issue in the upcoming major release of RadControls for Winforms.

I have found a workaround for you - here it is:

1. Subscribe to Calendar's PropertyChanged event
      this.radCalendar1.PropertyChanged += new PropertyChangedEventHandler(radCalendar1_PropertyChanged);

2. In the EventHandler write the following:

        void radCalendar1_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "FirstDayOfWeek")
            {
                this.radCalendar1.FocusedDate = this.radCalendar1.DefaultView.ViewStartDate.AddMonths(1);
                this.radCalendar1.FocusedDate = this.radCalendar1.FocusedDate.AddMonths(-1);
            }
        }

This code will re-create the calendar view correctly.

Please contact me again if you have more questions regarding RadCalendar.


All the best,
Boyko Markov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Marc
Top achievements
Rank 2
Answers by
Boyko Markov
Telerik team
Share this question
or