/// <summary> /// Update Date and IsValid property /// </summary> internal void InternalUpdate(CalendarDate cdate) { Date = cdate.Date; IsOtherMonth = cdate.IsOtherMonth; IsSelectable = cdate.IsSelectable; }
//------------------------------------------------------------------- // // Private Methods // //------------------------------------------------------------------- #region Private Methods /// <summary> /// Generate the visible days collection based on the input firstdate, lastdate and firstdayofweek /// </summary> private ObservableCollection<CalendarDate> CreateVisibleDaysCollection(DateTime firstDate, DateTime lastDate, DayOfWeek firstDayOfWeek) { DateTime leadingDate = CalendarDataGenerator.CalculateLeadingDate(firstDate, firstDayOfWeek); DateTime trailingDate = CalendarDataGenerator.CalculateTrailingDate(firstDate, lastDate, firstDayOfWeek); int totalDay = trailingDate.Subtract(leadingDate).Days + 1; ObservableCollection<CalendarDate> collection = new ObservableCollection<CalendarDate>(); for (int i = 0; i < totalDay; ++i) { CalendarDate cdate = new CalendarDate(leadingDate.AddDays(i)); cdate.IsOtherMonth = cdate.Date < FirstDate || cdate.Date > LastDate; cdate.IsSelectable = MonthCalendarHelper.IsWithinRange(cdate.Date, MinDate, MaxDate); collection.Add(cdate); } return collection; }