public MonthDescriptor(int month, int year, DateTime date, string label, StyleDescriptor style) { Month = month; Year = year; Date = date; Label = label; Style = style; }
public MonthCellDescriptor(DateTime date, bool isCurrentMonth, bool isSelectable, bool isSelected, bool isToday, bool isHighlighted, int value, RangeState rangeState, StyleDescriptor style) { DateTime = date; Value = value; IsCurrentMonth = isCurrentMonth; IsSelected = isSelected; IsHighlighted = isHighlighted; IsToday = isToday; IsSelectable = isSelectable; RangeState = rangeState; Style = style; }
public void SetStyle(StyleDescriptor style) { if (style.DateLabelFont != null) { this.Typeface = (style.DateLabelFont); } if (this.Selected) { SetBackgroundColor(style.SelectedDateBackgroundColor); SetTextColor(style.SelectedDateForegroundColor); } else if (_isToday) { SetBackgroundColor(style.TodayBackgroundColor); SetTextColor(style.TodayForegroundColor); } else if (_isHighlighted) { SetBackgroundColor(style.HighlightedDateBackgroundColor); if (_isCurrentMonth) { SetTextColor(style.HighlightedDateForegroundColor); } else { SetTextColor(style.InactiveDateForegroundColor); } } else if (!_isCurrentMonth) { SetBackgroundColor(style.InactiveDateBackgroundColor); SetTextColor(style.InactiveDateForegroundColor); } else { SetBackgroundColor(style.DateBackgroundColor); SetTextColor(style.DateForegroundColor); } }
public CalendarPickerView(Context context, IAttributeSet attrs) : base(context, attrs) { ResourceIdManager.UpdateIdValues(); _context = context; _styleDescriptor = new StyleDescriptor(); MyAdapter = new MonthAdapter(context, this); base.Adapter = MyAdapter; //base.Divider = null; //base.DividerHeight = 0; this.PageMargin = 32; SetPadding(0, 0, 0, 0); //Sometimes dates could not be selected after the transform. I had to disable it. :( //SetPageTransformer(true, new CalendarMonthPageTransformer()); var bgColor = base.Resources.GetColor(Resource.Color.calendar_bg); base.SetBackgroundColor(bgColor); //base.CacheColorHint = bgColor; MonthNameFormat = base.Resources.GetString(Resource.String.month_name_format); WeekdayNameFormat = base.Resources.GetString(Resource.String.day_name_format); FullDateFormat = CultureInfo.CurrentCulture.DateTimeFormat.LongDatePattern; ClickHandler += OnCellClicked; OnInvalidDateSelected += OnInvalidateDateClicked; this.SetOnPageChangeListener(new OnPageChangeListener(this)); if (base.IsInEditMode) { Init(DateTime.Now, DateTime.Now.AddYears(1), new DayOfWeek[] { }).WithSelectedDate(DateTime.Now); } }