Overriding the default value of DateTimePicker.FirstDayOfWeek

Jun 28, 2010 at 4:56 AM

In my company, we treat Saturday as the first day of the production week. Consequently I would like all DatePickers in my application to reflect that. I tried adding this to my App class's OnStartUp method, but it had no effect:

DatePicker.FirstDayOfWeekProperty.OverrideMetadata(typeof(DatePicker),
    new FrameworkPropertyMetadata(DayOfWeek.Saturday));

 

The working code for DatePicker (here on CodePlex) has this line in its instance constructor:

// Binding to FirstDayOfWeek and DisplayDate wont work
            this.FirstDayOfWeek = DateTimeHelper.GetCurrentDateFormat().FirstDayOfWeek;

Does this mean that DatePicker will ignore any property metadata overrides? Am I really going to have to set FirstDayOfWeek manually on all my DatePickers in the XAML?

Cheers,
Matt

ps. I suspect that it's getting the first day of the week from the PC's regional settings, but our SOE (such as it is) doesn't have this set, so this is no good to me.