public override void UpdateVisualsForCell(TKCalendar calendar, TKCalendarCell cell) { calendar.Theme = new TKCalendarIPadTheme(); calendar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; if (calendar.Presenter is TKCalendarMonthPresenter) { TKCalendarMonthPresenter presenter = calendar.Presenter as TKCalendarMonthPresenter; presenter.Style.DayNameTextEffect = TKCalendarTextEffect.None; } if (cell is TKCalendarCell) { TKCalendarDayCell dayCell = cell as TKCalendarDayCell; if (dayCell != null) { TKCalendarDayState selectedState = TKCalendarDayState.Selected; if ((dayCell.State & TKCalendarDayState.Today) != 0) { cell.Style.TextColor = UIColor.FromRGB(24, 149, 132); } if ((dayCell.State & selectedState) == selectedState) { cell.Style.BackgroundColor = UIColor.FromRGB(184, 184, 184); } } } base.UpdateVisualsForCell(calendar, cell); }
public override void UpdateVisualsForCell (TKCalendar calendar, TKCalendarCell cell) { cell.Style.TextColor = new UIColor (1f, 1f, 1f, 1f); cell.Style.BottomBorderWidth = 0; cell.Style.TopBorderWidth = 0; cell.Style.TextFont = UIFont.SystemFontOfSize (10); cell.Style.ShapeFill = new TKSolidFill(new UIColor(1f, 1f, 1f, 1f)); if(cell.IsKindOfClass(new ObjCRuntime.Class(typeof(TKCalendarDayCell)))) { TKCalendarDayCell dayCell = (TKCalendarDayCell)cell; if ((dayCell.State & TKCalendarDayState.Selected) != 0) { dayCell.Style.TextColor = new UIColor(0.5f, 0.7f, 0.2f, 1f); } } if(cell.IsKindOfClass(new ObjCRuntime.Class(typeof(TKCalendarDayNameCell)))) { TKCalendarDayNameCell dayNameCell = (TKCalendarDayNameCell)cell; dayNameCell.Label.Text = dayNameCell.Label.Text.Substring (0, 1); } if (cell.IsKindOfClass(new ObjCRuntime.Class(typeof(TKCalendarMonthTitleCell)))) { TKCalendarMonthTitleCell titleCell = (TKCalendarMonthTitleCell)cell; titleCell.LayoutMode = TKCalendarMonthTitleCellLayoutMode.MonthWithButtons; } }
public override void UpdateVisualsForCell(TKCalendar calendar, TKCalendarCell cell) { cell.Style.TextColor = new UIColor(1f, 1f, 1f, 1f); cell.Style.BottomBorderWidth = 0; cell.Style.TopBorderWidth = 0; cell.Style.TextFont = UIFont.SystemFontOfSize(10); cell.Style.ShapeFill = new TKSolidFill(new UIColor(1f, 1f, 1f, 1f)); if (cell.IsKindOfClass(new ObjCRuntime.Class(typeof(TKCalendarDayCell)))) { TKCalendarDayCell dayCell = (TKCalendarDayCell)cell; if ((dayCell.State & TKCalendarDayState.Selected) != 0) { dayCell.Style.TextColor = new UIColor(0.5f, 0.7f, 0.2f, 1f); } } if (cell.IsKindOfClass(new ObjCRuntime.Class(typeof(TKCalendarDayNameCell)))) { TKCalendarDayNameCell dayNameCell = (TKCalendarDayNameCell)cell; dayNameCell.Label.Text = dayNameCell.Label.Text.Substring(0, 1); } if (cell.IsKindOfClass(new ObjCRuntime.Class(typeof(TKCalendarMonthTitleCell)))) { TKCalendarMonthTitleCell titleCell = (TKCalendarMonthTitleCell)cell; titleCell.LayoutMode = TKCalendarMonthTitleCellLayoutMode.MonthWithButtons; } }
public override void UpdateVisualsForCell(TKCalendar calendar, TKCalendarCell cell) { if (cell.IsKindOfClass(new ObjCRuntime.Class(typeof(TKCalendarMonthTitleCell)))) { TKCalendarMonthTitleCell monthTitleCell = (TKCalendarMonthTitleCell)cell; monthTitleCell.LayoutMode = TKCalendarMonthTitleCellLayoutMode.MonthAndYearWithButotns; } }
public override void UpdateVisualsForCell(TKCalendar calendar, TKCalendarCell cell) { var dayCell = cell as TKCalendarDayCell; if (dayCell != null) { this.SetBordersWidth(dayCell, 0); TKCalendarDayState currentMonthState = TKCalendarDayState.CurrentMonth; if ((dayCell.State & currentMonthState) == currentMonthState) { dayCell.Style.BackgroundColor = Color.FromHex("#F8F8F8").ToUIColor(); dayCell.Style.TextColor = Color.FromHex("#000000").ToUIColor(); } else { dayCell.Style.BackgroundColor = Color.FromHex("#E0E0E0").ToUIColor(); dayCell.Style.TextColor = Color.FromHex("#FFFFFF").ToUIColor(); } TKCalendarDayState weekendState = TKCalendarDayState.Weekend; if ((dayCell.State & weekendState) == weekendState) { if ((dayCell.State & currentMonthState) == currentMonthState) { dayCell.Style.BackgroundColor = Color.FromHex("#EEEEEE").ToUIColor(); dayCell.Style.TextColor = Color.FromHex("#999999").ToUIColor(); } else { dayCell.Style.BackgroundColor = Color.FromHex("#D0D0D0").ToUIColor(); dayCell.Style.TextColor = Color.FromHex("#AAAAAA").ToUIColor(); } } TKCalendarDayState todayState = TKCalendarDayState.Today; if ((dayCell.State & todayState) == todayState) { var borderColor = Color.FromHex("#00FF44"); dayCell.Style.ShapeFill = null; this.SetBordersColor(dayCell, borderColor); this.SetBordersWidth(dayCell, 2); } TKCalendarDayState selectedState = TKCalendarDayState.Selected; if ((dayCell.State & selectedState) == selectedState) { var borderColor = Color.FromHex("#0044FF"); dayCell.Style.ShapeFill = null; this.SetBordersColor(dayCell, borderColor); this.SetBordersWidth(dayCell, 2); } } }
// >> customization-updatevisualcell-cs public override void UpdateVisualsForCell(TKCalendar calendar, TKCalendarCell cell) { if (cell is TKCalendarDayCell) { TKCalendarDayCell dayCell = (TKCalendarDayCell)cell; if ((dayCell.State & TKCalendarDayState.Today) != 0) { cell.Style.TextColor = UIColor.Red; } else { cell.Style.TextColor = UIColor.Purple; } } }
public override void UpdateVisualsForCell(TKCalendar calendar, TKCalendarCell cell) { if (cell is TKCalendarDayCell dayCell) { TKCalendarDayState todayState = TKCalendarDayState.Today; if ((dayCell.State & todayState) == todayState) { var borderColor = Color.FromHex("#0044FF").ToUIColor(); dayCell.Style.ShapeFill = null; cell.Style.TopBorderColor = borderColor; cell.Style.LeftBorderColor = borderColor; cell.Style.RightBorderColor = borderColor; cell.Style.BottomBorderColor = borderColor; cell.Style.TopBorderWidth = 2; cell.Style.LeftBorderWidth = 2; cell.Style.RightBorderWidth = 2; cell.Style.BottomBorderWidth = 2; } TKCalendarDayState selectedState = TKCalendarDayState.Selected; if ((dayCell.State & selectedState) == selectedState) { var borderColor = Color.FromHex("#00FF44").ToUIColor(); dayCell.Style.Shape = new TKPredefinedShape(TKShapeType.Square, new CGSize(30, 25)); dayCell.Style.ShapeFill = new TKSolidFill(borderColor); cell.Style.TopBorderColor = borderColor; cell.Style.LeftBorderColor = borderColor; cell.Style.RightBorderColor = borderColor; cell.Style.BottomBorderColor = borderColor; cell.Style.TopBorderWidth = 2; cell.Style.LeftBorderWidth = 2; cell.Style.RightBorderWidth = 2; cell.Style.BottomBorderWidth = 2; } } }