Exemplo n.º 1
0
        /// <summary>
        ///     Sets the colors.
        /// </summary>
        private void SetColors()
        {
            if (Element.BackgroundColor != Xamarin.Forms.Color.Default)
            {
                var andColor = Element.BackgroundColor.ToAndroid();
                _containerView.SetBackgroundColor(andColor);
                _picker.SetBackgroundColor(andColor);
                _picker.StyleDescriptor.BackgroundColor = andColor;
            }

            //Month title
            if (Element.ActualMonthTitleBackgroundColor != Xamarin.Forms.Color.Default)
            {
                _picker.StyleDescriptor.TitleBackgroundColor = Element.ActualMonthTitleBackgroundColor.ToAndroid();
            }
            if (Element.ActualMonthTitleForegroundColor != Xamarin.Forms.Color.Default)
            {
                _picker.StyleDescriptor.TitleForegroundColor = Element.ActualMonthTitleForegroundColor.ToAndroid();
            }

            //Navigation color arrows
            if (Element.ActualNavigationArrowsColor != Xamarin.Forms.Color.Default)
            {
                _leftArrow.Color  = Element.ActualNavigationArrowsColor.ToAndroid();
                _rightArrow.Color = Element.ActualNavigationArrowsColor.ToAndroid();
            }
            else
            {
                _leftArrow.Color  = _picker.StyleDescriptor.TitleForegroundColor;
                _rightArrow.Color = _picker.StyleDescriptor.TitleForegroundColor;
            }

            //Day of week label
            if (Element.ActualDayOfWeekLabelBackroundColor != Xamarin.Forms.Color.Default)
            {
                var andColor = Element.ActualDayOfWeekLabelBackroundColor.ToAndroid();
                _picker.StyleDescriptor.DayOfWeekLabelBackgroundColor = andColor;
            }
            if (Element.ActualDayOfWeekLabelForegroundColor != Xamarin.Forms.Color.Default)
            {
                var andColor = Element.ActualDayOfWeekLabelForegroundColor.ToAndroid();
                _picker.StyleDescriptor.DayOfWeekLabelForegroundColor = andColor;
            }

            _picker.StyleDescriptor.ShouldHighlightDaysOfWeekLabel = Element.ShouldHighlightDaysOfWeekLabels;

            //Default date color
            if (Element.ActualDateBackgroundColor != Xamarin.Forms.Color.Default)
            {
                var andColor = Element.ActualDateBackgroundColor.ToAndroid();
                _picker.StyleDescriptor.DateBackgroundColor = andColor;
            }
            if (Element.ActualDateForegroundColor != Xamarin.Forms.Color.Default)
            {
                var andColor = Element.ActualDateForegroundColor.ToAndroid();
                _picker.StyleDescriptor.DateForegroundColor = andColor;
            }

            //Inactive Default date color
            if (Element.ActualInactiveDateBackgroundColor != Xamarin.Forms.Color.Default)
            {
                var andColor = Element.ActualInactiveDateBackgroundColor.ToAndroid();
                _picker.StyleDescriptor.InactiveDateBackgroundColor = andColor;
            }
            if (Element.ActualInactiveDateForegroundColor != Xamarin.Forms.Color.Default)
            {
                var andColor = Element.ActualInactiveDateForegroundColor.ToAndroid();
                _picker.StyleDescriptor.InactiveDateForegroundColor = andColor;
            }

            //Today date color
            if (Element.ActualTodayDateBackgroundColor != Xamarin.Forms.Color.Default)
            {
                var andColor = Element.ActualTodayDateBackgroundColor.ToAndroid();
                _picker.StyleDescriptor.TodayBackgroundColor = andColor;
            }
            if (Element.ActualTodayDateForegroundColor != Xamarin.Forms.Color.Default)
            {
                var andColor = Element.ActualTodayDateForegroundColor.ToAndroid();
                _picker.StyleDescriptor.TodayForegroundColor = andColor;
            }

            //Highlighted date color
            if (Element.ActualHighlightedDateBackgroundColor != Xamarin.Forms.Color.Default)
            {
                var andColor = Element.ActualHighlightedDateBackgroundColor.ToAndroid();
                _picker.StyleDescriptor.HighlightedDateBackgroundColor = andColor;
            }
            if (Element.ActualHighlightedDateForegroundColor != Xamarin.Forms.Color.Default)
            {
                var andColor = Element.ActualHighlightedDateForegroundColor.ToAndroid();
                _picker.StyleDescriptor.HighlightedDateForegroundColor = andColor;
            }


            //Selected date
            if (Element.ActualSelectedDateBackgroundColor != Xamarin.Forms.Color.Default)
            {
                _picker.StyleDescriptor.SelectedDateBackgroundColor = Element.ActualSelectedDateBackgroundColor.ToAndroid();
            }
            if (Element.ActualSelectedDateForegroundColor != Xamarin.Forms.Color.Default)
            {
                _picker.StyleDescriptor.SelectedDateForegroundColor = Element.ActualSelectedDateForegroundColor.ToAndroid();
            }

            //Divider
            if (Element.DateSeparatorColor != Xamarin.Forms.Color.Default)
            {
                _picker.StyleDescriptor.DateSeparatorColor = Element.DateSeparatorColor.ToAndroid();
            }
        }