有一个DisplayModeChanged事件可以使用。我的案子我需要选定月份的第一天和最后一天。。。下面的代码可以满足我的需要。
private void CalendarDisplayModeChanged(object sender, CalendarModeChangedEventArgs e)
{
//control might be null at start up so check for null
//probably could hook up event in Loaded or constructor instead of xaml to prevent this
if (calendarInYearMode != null) {
//reset back to year mode
calendarInYearMode.DisplayMode = CalendarMode.Year;
if (calendarInYearMode.DisplayDate != DateTime.MinValue) {
var beginningOfMonthDate = calendarInYearMode.DisplayDate;
var endOfMonthDate = calendarInYearMode.DisplayDate.AddMonths(1).AddDays(-1);
}
}
}