Example #1
0
        private void ConfigCell(FSCalendarCell cell, NSDate date, FSCalendarMonthPosition monthPosition)
        {
            var rangeCell = cell as RangePickerCell;

            if (monthPosition != FSCalendarMonthPosition.Current)
            {
                rangeCell.MiddleLayer.Hidden    = true;
                rangeCell.SelectionLayer.Hidden = true;
                return;
            }
            if (Date1 != null && Date2 != null)
            {
                // The date is in the middle of the range
                var isMiddle = date.Compare(Date1) != date.Compare(Date2);
                rangeCell.MiddleLayer.Hidden = !isMiddle;
            }
            else
            {
                rangeCell.MiddleLayer.Hidden = true;
            }
            var isSelected = false;

            isSelected |= Date1 != null && Gregorian.IsInSameDay(date, Date1);
            isSelected |= Date2 != null && Gregorian.IsInSameDay(date, Date2);
            rangeCell.SelectionLayer.Hidden = !isSelected;
        }