/// <summary> /// Initializes a new instance of the <see cref="CalendarMonthView"/> class. /// </summary> /// <param name="selectedDate">The selected date.</param> /// <param name="showHeader">if set to <c>true</c> [show header].</param> /// <param name="showNavArrows">if set to <c>true</c> [show nav arrows].</param> /// <param name="width">The width.</param> public CalendarMonthView(DateTime selectedDate, bool showHeader, bool showNavArrows, float width = 320) { _showHeader = showHeader; _showNavArrows = showNavArrows; if (_showNavArrows) { _showHeader = true; } StyleDescriptor = new StyleDescriptor(); HighlightDaysOfWeeks(new DayOfWeek[] { }); if (_showHeader && _headerHeight == 0) { _headerHeight = showNavArrows ? 40 : 20; } Frame = _showHeader ? new CGRect(0, 0, width, 198 + _headerHeight) : new CGRect(0, 0, width, 198); BoxWidth = Convert.ToInt32(Math.Ceiling(width / 7)); BackgroundColor = UIColor.White; ClipsToBounds = true; CurrentDate = DateTime.Now.Date; CurrentMonthYear = new DateTime(CurrentDate.Year, CurrentDate.Month, 1); CurrentSelectedDate = selectedDate; var swipeLeft = new UISwipeGestureRecognizer(MonthViewSwipedLeft) { Direction = UISwipeGestureRecognizerDirection.Left }; AddGestureRecognizer(swipeLeft); var swipeRight = new UISwipeGestureRecognizer(MonthViewSwipedRight) { Direction = UISwipeGestureRecognizerDirection.Right }; AddGestureRecognizer(swipeRight); var swipeUp = new UISwipeGestureRecognizer(MonthViewSwipedUp) { Direction = UISwipeGestureRecognizerDirection.Up }; AddGestureRecognizer(swipeUp); }