Inheritance: Xamarin.Forms.View
        public HomeTopPanel( DateTime selectedDate)
        {
            SelectedDate = selectedDate;
            selectedMonth = SelectedDate.Month;
            selectedYear = selectedDate.Year;
            // Today's content view.
            var currentDayLayout = new ContentView {
                Padding = 6,
                Content = new DefaultLabel {
                    HorizontalOptions = LayoutOptions.Center,
                    Text = selectedDate.ToString("dddd", new CultureInfo("en-US"))
                }
            };

            calendarView = new CalendarView {
                VerticalOptions = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            // Home page tabs.
            todayButton = new TopPanelItem("Today", currentDayLayout, true);
            monthButton = new TopPanelItem(SelectedDate.ToString("MMMM", new CultureInfo("en-US")));
            yearButton = new TopPanelItem(SelectedDate.Year.ToString(), calendarView);

            Items = new List<TopPanelItem> {todayButton, monthButton, yearButton};

            Children.Add(todayButton);
            Children.Add(monthButton);
            Children.Add(yearButton);

            DefaultView = todayButton.ContentView;
            LastView = todayButton.ContentView;
            todayButton.OnTap += SelectToday;
            yearButton.OnTap += ShowCalender;
            monthButton.OnTap += ShowMonthLayout;

            calendarView.MonthChanged += (sender, newMonth) => ChangeMonth(newMonth);
            calendarView.DateSelected += (sender, newDate) => {
                SelectDate (newDate);
                ShowMonthLayout();
            };

            BottomPanel = new ContentView ();
            OnItemSelected = view => {
                if (view != null)
                    BottomPanel.Content = view;
            };
            BottomPanel.Content = DefaultView;
        }
        protected override void OnElementChanged( ElementChangedEventArgs<View> e )
        {
            base.OnElementChanged(e);

            view = (CalendarView) Element;

            if (view != null) {
                calendarView = new CalendarMonthView (view?.SelectedDate ?? DateTime.Today, false);
                calendarView.SwipedUp += view.Hide;
                calendarView.OnDateSelected += view.NotifyDateSelected;
                calendarView.MonthChanged += view.NotifyMonthChanged;

                try {
                    SetNativeControl (calendarView);
                } catch {
                    // Hiding calendar causes null reference exception.
                }
            }
        }