예제 #1
0
        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)
        {
            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);
                }
            }
        }
        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;
                }
            }
        }