CalendarDate is a wrapper over DateTime
The main purpose of CalendarDate is to increase the MonthCalendar's scroll perf. It is used to only update Date object and fire a PropertyChanged event, so when user scroll month, the selectedDates UI items won't be regenerated
Inheritance: INotifyPropertyChanged
Esempio n. 1
0
 /// <summary>
 /// Update Date and IsValid property
 /// </summary>
 internal void InternalUpdate(CalendarDate cdate)
 {
     Date = cdate.Date;
     IsOtherMonth = cdate.IsOtherMonth;
     IsSelectable = cdate.IsSelectable;
 }
Esempio n. 2
0
        /// <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;
        }
 /// <summary>
 /// Update Date and IsValid property
 /// </summary>
 internal void InternalUpdate(CalendarDate cdate)
 {
     Date         = cdate.Date;
     IsOtherMonth = cdate.IsOtherMonth;
     IsSelectable = cdate.IsSelectable;
 }