I updated Calendar control for Windows Phone 7 on CodePlex today.
I added support for other languages as well as published the package to NuGet.
You can added it to your Windows Phone 7 applications, both targeting 7.0 and 7.1 versions by typing the following into NuGet package manager console: Install-Package WPControls
You can also see package details at https://nuget.org/packages/WPControls
I wanted to illustrate right quick how I added support for other languages. There are only a few things I have to localize: week day names and month names. It happens, that both are very easy to do through DateTimeFormat object.
Here is how I am setting week day names:
_dateTimeFormatInfo = !CultureInfo.CurrentCulture.IsNeutralCulture ? CultureInfo.CurrentCulture.DateTimeFormat : (new CultureInfo("en-US")).DateTimeFormat;
I have to protect against neutral cultures, so I am using en-US as default for those.
private void SetupDaysOfWeekLabels() { Sunday = _dateTimeFormatInfo.AbbreviatedDayNames[0]; Monday = _dateTimeFormatInfo.AbbreviatedDayNames[1]; Tuesday = _dateTimeFormatInfo.AbbreviatedDayNames[2]; Wednesday = _dateTimeFormatInfo.AbbreviatedDayNames[3]; Thursday = _dateTimeFormatInfo.AbbreviatedDayNames[4]; Friday = _dateTimeFormatInfo.AbbreviatedDayNames[5]; Saturday = _dateTimeFormatInfo.AbbreviatedDayNames[6]; }
As you can see this is very easy to do. I am making my week start on Sunday and in my control template I use TemplateBinding to point to my Sunday through Saturday properties.
Month name is just as easy.
private string GetMonthName() { string returnValue = _dateTimeFormatInfo.MonthNames[_month - 1]; return returnValue; }
My _month variable contains month number 1 through 12.
That is all there is to it.
Enjoy and please continue providing feedback for Calendar control.
Thanks.