In the spirit of further improving my calendar control for Windows Phone 7, I added ability to show week number in the first column of the calendar control.
As you can see, the very first column can show week number,. If course, I cannot break existing functionality, so the feature is disabled by default. You can enable it by setting appropriate property on calendar control, called WeekNumberDisplay. It has three options:
/// Option of how to display week numbers in the calendar
public enum WeekNumberDisplayOption
/// Do not show week number
None = 0,
/// Show week number starting with start of the year
WeekOfYear = 1,
/// Show week number starting with start of month
WeekOfMonth = 2
So, you have options to show week of the year, week of the month or none. Week of the month is simply number that starts with 1. As far as week of the year goes, I am using built in functionality to properly determine this using localization rules as follows.
var systemCalendar = System.Threading.Thread.CurrentThread.CurrentCulture.Calendar;
weekNumber = systemCalendar.GetWeekOfYear(
You can use this code any time you need to determine week number.
You can visit the home page for calendar control to download the latest source code.
Thank you and keep the suggestions coming.