Beispiel #1
0
        protected override void OnAttachedTo(SampleView bindable)
        {
            base.OnAttachedTo(bindable);

            this.calendar  = bindable.Content.FindByName <Syncfusion.SfCalendar.XForms.SfCalendar>("calendar");
            this.viewModel = bindable.BindingContext as LocalizationViewModel;
            this.grid      = bindable.Content.FindByName <Grid>("grid");
            if (Device.RuntimePlatform == "UWP")
            {
                this.grid.HorizontalOptions = LayoutOptions.Center;
                this.grid.VerticalOptions   = LayoutOptions.Center;
                this.grid.HeightRequest     = this.calendarHeight;
                this.grid.WidthRequest      = this.calendarWidth;
                bindable.SizeChanged       += this.Bindable_SizeChanged;
            }

            this.calendar.Locale         = new System.Globalization.CultureInfo("zh-CN");
            this.calendar.FirstDayofWeek = 1;
            MonthViewSettings monthSettings = new MonthViewSettings
            {
                HeaderBackgroundColor         = Color.White,
                InlineBackgroundColor         = Color.FromHex("#EEEEEE"),
                DateSelectionColor            = Color.FromHex("#EEEEEE"),
                TodayTextColor                = Color.Red,
                SelectedDayTextColor          = Color.Black,
                DayHeaderFormat               = "EEE",
                TodaySelectionBackgroundColor = Color.Red,
                TodayBorderColor              = Color.Transparent
            };

            this.calendar.MonthViewSettings = monthSettings;
            if (Device.Idiom == TargetIdiom.Tablet)
            {
                if (Device.RuntimePlatform == "Android")
                {
                    this.calendar.MonthViewSettings.SelectionRadius = 30;
                }
                else
                {
                    this.calendar.MonthViewSettings.SelectionRadius = 20;
                }
            }

            if (Device.RuntimePlatform == "Android" || (Device.RuntimePlatform == "UWP" && Device.Idiom == TargetIdiom.Desktop))
            {
                this.calendar.HeaderHeight = 50;
            }
            else if (Device.RuntimePlatform == "iOS")
            {
                this.calendar.HeaderHeight = 40;
            }

            var localePicker = bindable.Content.FindByName <Picker>("localePicker");

            localePicker.SelectedIndex         = 0;
            localePicker.SelectedIndexChanged += LocalePicker_SelectedIndexChanged;;
        }
Beispiel #2
0
        protected override void OnAttachedTo(SampleView bindable)
        {
            base.OnAttachedTo(bindable);

            this.calendar        = bindable.Content.FindByName <Syncfusion.SfCalendar.XForms.SfCalendar>("calendar");
            this.viewModel       = bindable.BindingContext as LocalizationViewModel;
            this.calendar.Locale = new System.Globalization.CultureInfo("zh-CN");
            MonthViewSettings monthSettings = new MonthViewSettings();

            if (Device.RuntimePlatform == "Android")
            {
                monthSettings.DayCellFont = Font.SystemFontOfSize(15);
                if (Device.Idiom == TargetIdiom.Tablet)
                {
                    monthSettings.SelectionRadius = 25;
                }
                else
                {
                    monthSettings.SelectionRadius = 20;
                }
            }
            else if (Device.RuntimePlatform == "iOS")
            {
                monthSettings.SelectionRadius = 15;
            }

            monthSettings.HeaderFont            = Font.OfSize("SemiBold", monthSettings.HeaderFont.FontSize);
            monthSettings.HeaderBackgroundColor = Color.White;
            monthSettings.InlineBackgroundColor = Color.FromHex("#EEEEEE");
            monthSettings.DateSelectionColor    = Color.FromHex("#EEEEEE");
            monthSettings.TodayTextColor        = Color.FromHex("#2196F3");
            monthSettings.SelectedDayTextColor  = Color.Black;
            monthSettings.DayLabelTextAlignment = DayLabelTextAlignment.Center;
            monthSettings.CellGridOptions       = CellGridOptions.None;
            monthSettings.SelectionShape        = SelectionShape.Circle;
            monthSettings.DateTextAlignment     = DateTextAlignment.Center;
            this.calendar.MonthViewSettings     = monthSettings;
            this.calendar.FirstDayofWeek        = 1;
            if (Device.RuntimePlatform == "Android" || (Device.RuntimePlatform == "UWP" && Device.Idiom == TargetIdiom.Desktop))
            {
                this.calendar.HeaderHeight = 50;
            }
            else if (Device.RuntimePlatform == "iOS")
            {
                this.calendar.HeaderHeight = 40;
            }

            var localePicker = bindable.Content.FindByName <Picker>("localePicker");

            localePicker.SelectedIndex         = 0;
            localePicker.SelectedIndexChanged += LocalePicker_SelectedIndexChanged;;
        }
Beispiel #3
0
        protected override void OnAttachedTo(SampleView bindable)
        {
            base.OnAttachedTo(bindable);

            this.calendar        = bindable.Content.FindByName <Syncfusion.SfCalendar.XForms.SfCalendar>("calendar");
            this.viewModel       = bindable.BindingContext as LocalizationViewModel;
            this.calendar.Locale = new System.Globalization.CultureInfo("zh-CN");
            MonthViewSettings monthSettings = new MonthViewSettings();

            if (Device.RuntimePlatform == "Android")
            {
                if (Device.Idiom == TargetIdiom.Tablet)
                {
                    monthSettings.SelectionRadius = 25;
                }
                else
                {
                    monthSettings.SelectionRadius = 20;
                }
            }
            else if (Device.RuntimePlatform == "iOS")
            {
                monthSettings.SelectionRadius = 15;
            }

            monthSettings.HeaderBackgroundColor         = Color.White;
            monthSettings.InlineBackgroundColor         = Color.FromHex("#EEEEEE");
            monthSettings.DateSelectionColor            = Color.FromHex("#EEEEEE");
            monthSettings.TodayTextColor                = Color.FromHex("#2196F3");
            monthSettings.SelectedDayTextColor          = Color.Black;
            monthSettings.DayHeaderFormat               = "EEE";
            monthSettings.TodaySelectionBackgroundColor = Color.Red;
            monthSettings.TodayBorderColor              = Color.Transparent;
            monthSettings.TodayTextColor                = Color.Red;
            this.calendar.MonthViewSettings             = monthSettings;
            this.calendar.FirstDayofWeek                = 1;
            if (Device.RuntimePlatform == "Android" || (Device.RuntimePlatform == "UWP" && Device.Idiom == TargetIdiom.Desktop))
            {
                this.calendar.HeaderHeight = 50;
            }
            else if (Device.RuntimePlatform == "iOS")
            {
                this.calendar.HeaderHeight = 40;
            }

            var localePicker = bindable.Content.FindByName <Picker>("localePicker");

            localePicker.SelectedIndex         = 0;
            localePicker.SelectedIndexChanged += LocalePicker_SelectedIndexChanged;;
        }