public MainPage()
        {
            BackgroundColor = Color.DarkOliveGreen;
            var now = DateTime.Now;


            for (var i = 0; i < 3; i++)
            {
                viewModel.source.Add(SetDateGrid(now.AddMonths(i)));
            }

            viewModel.Months = new ObservableCollection <Month>(viewModel.source);

            BindingContext = viewModel;

            _dayTapGestureRecognizer.Tapped += OnDateSelected;

            var carouselView = new CarouselView
            {
                //HeightRequest = 300,
                //WidthRequest = 300,
                Margin            = 20,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };

            carouselView.SetBinding(ItemsView.ItemsSourceProperty, "Months");


            carouselView.ItemTemplate = new DataTemplate(() =>
            {
                var dayGrid = new Grid
                {
                    //ColumnSpacing = 15,
                    //RowSpacing = 15,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                };
                dayGrid.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Auto)
                });

                for (var i = 0; i < 6; i++)
                {
                    dayGrid.RowDefinitions.Add(new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    });
                }

                for (var i = 0; i < 7; i++)
                {
                    dayGrid.ColumnDefinitions.Add(new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    });
                }

                for (var row = 0; row < 7; row++)
                {
                    for (var col = 0; col < 7; col++)
                    {
                        var cell = new CellStackLayout
                        {
                            VerticalOptions   = LayoutOptions.FillAndExpand,
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                        };

                        var label = new Label
                        {
                            VerticalOptions         = LayoutOptions.CenterAndExpand,
                            HorizontalOptions       = LayoutOptions.CenterAndExpand,
                            VerticalTextAlignment   = TextAlignment.Center,
                            HorizontalTextAlignment = TextAlignment.Center,
                        };
                        var index = row * 7 + col;

                        cell.SetBinding(CellStackLayout.DateTimeInfoProperty, $"Day[{index}].ThisDateTime");
                        cell.SetBinding(IsVisibleProperty, $"Day[{index}].IsEnabled");
                        // cell.SetBinding(BackgroundColorProperty, $"Day[{index}].SelectedBackgroundColor");

                        label.SetBinding(Label.TextProperty, $"Day[{index}].ThisDay");
                        label.SetBinding(Label.TextColorProperty, $"Day[{index}].Color");

                        cell.Children.Add(label);



                        if (row != 0)
                        {
                            AddDayTapGesture(cell);

                            _cellList.Add(cell);
                        }


                        var cellFrame = new Frame
                        {
                            Content     = cell,
                            Margin      = 0,
                            Padding     = 0,
                            BorderColor = Color.White,
                            HasShadow   = false,
                            //    CornerRadius=20,
                            IsClippedToBounds = true
                        };


                        dayGrid.Children.Add(cellFrame, col, row);
                    }
                }

                var yearLabel = new Label
                {
                    FontSize       = 20,
                    FontAttributes = FontAttributes.Bold
                };
                yearLabel.SetBinding(Label.TextProperty, "ThisYear");

                var monthLabel = new Label
                {
                    FontSize       = 20,
                    FontAttributes = FontAttributes.Bold
                };
                monthLabel.SetBinding(Label.TextProperty, "ThisMonth");
                monthLabel.SetBinding(Label.TextColorProperty, "Color");

                var yearAndMonthStackLayout = new StackLayout
                {
                    Orientation = StackOrientation.Horizontal,
                    Children    = { yearLabel, monthLabel }
                };

                return(new StackLayout
                {
                    Padding = 10,
                    Children =
                    {
                        yearAndMonthStackLayout,

                        new Frame
                        {
                            BorderColor = Color.DeepPink,
                            HasShadow = false,
                            Padding = 0,
                            Margin = 0,
                            Content = dayGrid
                        }
                    }
                });
            });

            var month    = viewModel.Months.FirstOrDefault(x => x.ThisMonth == DateTime.Now.Month.ToString());
            var position = viewModel.source.ToList().FindIndex(x => x.ThisMonth == DateTime.Now.Month.ToString());

            //carouselView.CurrentItem = month;
            //carouselView.Position = position;
            carouselView.ScrollTo(position, animate: false);

            var button = new Button()
            {
                Text     = "Go to Today",
                FontSize = 30
            };

            button.Clicked += (s, e) =>
            {
                //carouselView.CurrentItem = month;
                //carouselView.Position = position;
                carouselView.ScrollTo(position, animate: false);
            };

            Content = new StackLayout
            {
                Padding  = 20,
                Children = { carouselView, button }
            };
        }
 private void AddYearTapGesture(CellStackLayout cell)
 {
     cell.GestureRecognizers.Clear();
     cell.GestureRecognizers.Add(_dayTapGestureRecognizer);
 }