Example #1
0
        protected override void OnAttachedTo(SampleView bindable)
        {
            base.OnAttachedTo(bindable);
            this.calendar = bindable.Content.FindByName <Syncfusion.SfCalendar.XForms.SfCalendar>("calendar");
            ObservableCollection <string> customLabels = new ObservableCollection <string> {
                "S", "M", "T", "W", "T", "F", "S"
            };

            this.calendar.CustomDayLabels = customLabels;
            this.calendar.MonthViewSettings.HeaderFont            = Font.OfSize("SemiBold", this.calendar.MonthViewSettings.HeaderFont.FontSize);
            this.calendar.MonthViewSettings.HeaderBackgroundColor = Color.White;
            this.calendar.MonthViewSettings.DateSelectionColor    = Color.White;
            this.calendar.MonthViewSettings.TodayTextColor        = Color.White;
            this.calendar.MonthViewSettings.SelectedDayTextColor  = Color.Black;
            this.calendar.MonthViewSettings.CellGridOptions       = CellGridOptions.None;
            this.calendar.MonthViewSettings.DayLabelTextAlignment = DayLabelTextAlignment.Center;
            if (Device.RuntimePlatform == "Android" || (Device.RuntimePlatform == "UWP" && Device.Idiom == TargetIdiom.Desktop))
            {
                this.calendar.HeaderHeight = 50;
            }
            else if (Device.RuntimePlatform == "iOS")
            {
                this.calendar.HeaderHeight = 40;
            }

            this.calendar.OnMonthCellLoaded += Calendar_OnMonthCellLoaded;
        }
        protected override void OnAttachedTo(SampleView bindable)
        {
            base.OnAttachedTo(bindable);
            this.calendar = bindable.Content.FindByName <Syncfusion.SfCalendar.XForms.SfCalendar>("calendar");
            this.calendar.InlineViewMode             = InlineViewMode.Agenda;
            this.calendar.ShowLeadingAndTrailingDays = false;
            this.calendar.BackgroundColor            = Color.White;

            this.calendar.MonthViewSettings.DayHeight             = 50;
            this.calendar.MonthViewSettings.WeekEndTextColor      = Color.FromHex("#009688");
            this.calendar.MonthViewSettings.HeaderBackgroundColor = Color.White;
            this.calendar.MonthViewSettings.InlineBackgroundColor = Color.White;
            this.calendar.MonthViewSettings.DateSelectionColor    = Color.FromHex("#EEEEEE");
            this.calendar.MonthViewSettings.TodayTextColor        = Color.Red;
            this.calendar.MonthViewSettings.TodayBorderColor      = Color.Red;
            this.calendar.MonthViewSettings.SelectedDayTextColor  = Color.Black;
            if (Device.RuntimePlatform == "Android" || (Device.RuntimePlatform == "UWP" && Device.Idiom == TargetIdiom.Desktop))
            {
                this.calendar.HeaderHeight = 50;
            }
            else if (Device.RuntimePlatform == "iOS")
            {
                this.calendar.HeaderHeight = 40;
            }
        }
Example #3
0
        protected override void OnAttachedTo(SampleView bindable)
        {
            base.OnAttachedTo(bindable);
            this.calendar = bindable.Content.FindByName <Syncfusion.SfCalendar.XForms.SfCalendar>("calendar");
            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.MonthViewSettings.HeaderBackgroundColor = Color.White;
            this.calendar.MonthViewSettings.SelectedDayTextColor  = Color.Black;
            this.calendar.ShowLeadingAndTrailingDays = false;
            if (Device.RuntimePlatform == "Android" || (Device.RuntimePlatform == "UWP" && Device.Idiom == TargetIdiom.Desktop))
            {
                this.calendar.HeaderHeight = 50;
            }
            else if (Device.RuntimePlatform == "iOS")
            {
                this.calendar.HeaderHeight = 40;
            }

            this.calendar.OnMonthCellLoaded += Calendar_OnMonthCellLoaded;
        }
        protected override void OnDetachingFrom(ContentPage bindable)
        {
            base.OnDetachingFrom(bindable);

            this.grid     = null;
            this.calendar = null;
        }
Example #5
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;;
        }
        protected override void OnAttachedTo(SampleView bindable)
        {
            base.OnAttachedTo(bindable);
            bindable.SizeChanged += Bindable_SizeChanged;

            this.calendar = bindable.Content.FindByName <Syncfusion.SfCalendar.XForms.SfCalendar>("calendar");
            this.calendar.InlineViewMode = InlineViewMode.Agenda;
            this.calendar.MonthViewSettings.SelectionShape = SelectionShape.Circle;
            this.calendar.NumberOfWeeksInView = 1;
        }
        protected override void OnDetachingFrom(SampleView bindable)
        {
            base.OnDetachingFrom(bindable);
            if (Device.RuntimePlatform == "UWP")
            {
                bindable.SizeChanged -= this.Bindable_SizeChanged;
            }

            this.grid     = null;
            this.calendar = null;
        }
 protected override void OnAttachedTo(SampleView bindable)
 {
     base.OnAttachedTo(bindable);
     this.calendar = bindable.Content.FindByName <Syncfusion.SfCalendar.XForms.SfCalendar>("calendar");
     this.grid     = bindable.Content.FindByName <Grid>("grid");
     if (Device.RuntimePlatform == "UWP")
     {
         this.grid.HorizontalOptions = LayoutOptions.Center;
         this.grid.WidthRequest      = this.calendarWidth;
         bindable.SizeChanged       += this.Bindable_SizeChanged;
     }
 }
Example #9
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;;
        }
Example #10
0
        protected override void OnAttachedTo(SampleView bindable)
        {
            base.OnAttachedTo(bindable);
            this.calendar = bindable.Content.FindByName <Syncfusion.SfCalendar.XForms.SfCalendar>("calendar");
            ObservableCollection <string> customLabels = new ObservableCollection <string> {
                "S", "M", "T", "W", "T", "F", "S"
            };

            this.calendar.CustomDayLabels = customLabels;
            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;
            if (Device.RuntimePlatform == "Android" || (Device.RuntimePlatform == "UWP" && Device.Idiom == TargetIdiom.Desktop))
            {
                this.calendar.HeaderHeight = 50;
            }
            else if (Device.RuntimePlatform == "iOS")
            {
                this.calendar.HeaderHeight = 40;
            }

            this.calendar.OnMonthCellLoaded += Calendar_OnMonthCellLoaded;
        }
Example #11
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;;
        }
        protected override void OnAttachedTo(SampleView bindable)
        {
            base.OnAttachedTo(bindable);
            this.calendar = bindable.Content.FindByName <Syncfusion.SfCalendar.XForms.SfCalendar>("calendar");
            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;
            }

            MonthViewSettings monthSettings = new MonthViewSettings
            {
                HeaderBackgroundColor = Color.White,
                TodayBorderColor      = Color.FromHex("#2196F3"),
                TodayTextColor        = Color.FromHex("#2196F3"),
                BlackoutColor         = Color.Red
            };

            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;
            }

            this.calendar.OnMonthCellLoaded += Calendar_OnMonthCellLoaded;
        }
Example #13
0
        protected override void OnAttachedTo(ContentPage bindable)
        {
            base.OnAttachedTo(bindable);
            this.calendar = bindable.Content.FindByName <Syncfusion.SfCalendar.XForms.SfCalendar>("calendar");
            this.grid     = bindable.Content.FindByName <Grid>("grid");

            this.calendar.InlineViewMode                          = InlineViewMode.Agenda;
            this.calendar.ShowLeadingAndTrailingDays              = false;
            this.calendar.BackgroundColor                         = Color.White;
            this.calendar.MonthViewSettings.DayHeight             = 50;
            this.calendar.MonthViewSettings.WeekEndTextColor      = Color.FromHex("#009688");
            this.calendar.MonthViewSettings.HeaderBackgroundColor = Color.White;
            this.calendar.MonthViewSettings.InlineBackgroundColor = Color.White;
            this.calendar.MonthViewSettings.DateSelectionColor    = Color.FromHex("#EEEEEE");
            this.calendar.MonthViewSettings.TodayTextColor        = Color.Red;
            this.calendar.MonthViewSettings.TodayBorderColor      = Color.Red;
            this.calendar.MonthViewSettings.SelectedDayTextColor  = Color.Black;
        }
        protected override void OnAttachedTo(SampleView bindable)
        {
            base.OnAttachedTo(bindable);
            this.calendar = bindable.Content.FindByName <Syncfusion.SfCalendar.XForms.SfCalendar>("calendar");
            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;
            }

            if (Device.Idiom == TargetIdiom.Tablet)
            {
                this.calendar.MonthViewSettings.SelectionRadius = 20;
            }

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

            this.calendar.OnMonthCellLoaded += Calendar_OnMonthCellLoaded;
        }
        private void Calendar_SelectionChanged(Syncfusion.SfCalendar.XForms.SfCalendar sender, Syncfusion.SfCalendar.XForms.SelectionChangedEventArgs e)
        {
            if (sender.SelectedRange != null)
            {   //access to selectedRange
                var startDateObj = (Syncfusion.SfCalendar.XForms.SelectionRange)sender.SelectedRange;

                startDate = startDateObj.StartDate.Date;

                var endDateObj = (Syncfusion.SfCalendar.XForms.SelectionRange)sender.SelectedRange;
                endDate = endDateObj.EndDate.Date;

                var dateRange = Enumerable.Range(0, 1 + endDate.Subtract(startDate).Days)
                                .Select(offset => startDate.AddDays(offset))
                                .ToArray();

                Label_Start.Text = startDate.ToString("dd/MM/yyyy");
                Label_End.Text   = endDate.ToString("dd/MM/yyyy");
            }
        }
        protected override void OnAttachedTo(SampleView bindable)
        {
            base.OnAttachedTo(bindable);
            this.calendar = bindable.Content.FindByName <Syncfusion.SfCalendar.XForms.SfCalendar>("calendar");
            var customLabels = new ObservableCollection <string> {
                "S", "M", "T", "W", "T", "F", "S"
            };

            this.calendar.CustomDayLabels = customLabels;
            if (Device.RuntimePlatform == "Android")
            {
                this.calendar.MonthViewSettings.DayCellFont = Font.SystemFontOfSize(15);
            }

            this.calendar.InlineViewMode = InlineViewMode.Agenda;
            this.calendar.MonthViewSettings.HeaderFont            = Font.OfSize("SemiBold", this.calendar.MonthViewSettings.HeaderFont.FontSize);
            this.calendar.MonthViewSettings.DayHeight             = 50;
            this.calendar.MonthViewSettings.DayLabelTextAlignment = DayLabelTextAlignment.Center;
            this.calendar.MonthViewSettings.DateTextAlignment     = DateTextAlignment.Center;
            this.calendar.MonthViewSettings.SelectionShape        = SelectionShape.Fill;
            this.calendar.MonthViewSettings.WeekEndTextColor      = Color.FromHex("#009688");
            this.calendar.MonthViewSettings.HeaderBackgroundColor = Color.White;
            if (Device.RuntimePlatform == "iOS")
            {
                this.calendar.MonthViewSettings.InlineBackgroundColor = Color.White;
            }
            else
            {
                this.calendar.MonthViewSettings.InlineBackgroundColor = Color.FromHex("#EEEEEE");
            }

            this.calendar.MonthViewSettings.DateSelectionColor   = Color.FromHex("#EEEEEE");
            this.calendar.MonthViewSettings.TodayTextColor       = Color.FromHex("#2196F3");
            this.calendar.MonthViewSettings.SelectedDayTextColor = Color.Black;
            if (Device.RuntimePlatform == "Android" || (Device.RuntimePlatform == "UWP" && Device.Idiom == TargetIdiom.Desktop))
            {
                this.calendar.HeaderHeight = 50;
            }
            else if (Device.RuntimePlatform == "iOS")
            {
                this.calendar.HeaderHeight = 40;
            }
        }
Example #17
0
        protected override void OnAttachedTo(SampleView bindable)
        {
            base.OnAttachedTo(bindable);
            this.calendar = bindable.Content.FindByName <Syncfusion.SfCalendar.XForms.SfCalendar>("calendar");
            this.calendar.MonthViewSettings.HeaderBackgroundColor = Color.White;
            this.calendar.MonthViewSettings.SelectedDayTextColor  = Color.Black;
            this.calendar.ShowLeadingAndTrailingDays = false;
            if (Device.RuntimePlatform == "Android" || (Device.RuntimePlatform == "UWP" && Device.Idiom == TargetIdiom.Desktop))
            {
                this.calendar.HeaderHeight = 50;
            }
            else if (Device.RuntimePlatform == "iOS")
            {
                this.calendar.HeaderHeight = 40;
            }



            this.calendar.OnMonthCellLoaded += Calendar_OnMonthCellLoaded;
        }
Example #18
0
        protected override void OnAttachedTo(SampleView bindable)
        {
            base.OnAttachedTo(bindable);
            bindable.SizeChanged        += Bindable_SizeChanged;
            this.calendar                = bindable.Content.FindByName <Syncfusion.SfCalendar.XForms.SfCalendar>("calendar");
            this.calendar.InlineViewMode = InlineViewMode.Agenda;
            this.calendar.MonthViewSettings.SelectionShape = SelectionShape.Circle;
            if (Device.Idiom == TargetIdiom.Tablet)
            {
                if (Device.RuntimePlatform == "Android")
                {
                    this.calendar.MonthViewSettings.SelectionRadius = 30;
                }
                else
                {
                    this.calendar.MonthViewSettings.SelectionRadius = 20;
                }
            }

            this.calendar.NumberOfWeeksInView = 1;
        }
        protected override void OnAttachedTo(SampleView bindable)
        {
            base.OnAttachedTo(bindable);
            bindable.SizeChanged += Bindable_SizeChanged;
            this.calendar         = bindable.Content.FindByName <Syncfusion.SfCalendar.XForms.SfCalendar>("calendar");
            this.grid             = bindable.Content.FindByName <Grid>("grid");
            if (Device.RuntimePlatform == "UWP")
            {
                this.grid.HorizontalOptions = LayoutOptions.Center;
                this.grid.WidthRequest      = this.calendarWidth;
                bindable.SizeChanged       += this.Bindable_SizeChanged;
            }

            this.calendar.InlineViewMode = InlineViewMode.Agenda;
            this.calendar.MonthViewSettings.SelectionShape = SelectionShape.Circle;
            if (Device.RuntimePlatform == "UWP")
            {
                this.calendar.MaximumEventIndicatorCount           = 1;
                this.calendar.MonthViewSettings.InlineTextColor    = Color.Black;
                this.calendar.MonthViewSettings.DayHeaderTextColor = Color.Black;
            }

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

            this.calendar.NumberOfWeeksInView = 1;
        }
 protected override void OnDetachingFrom(SampleView bindable)
 {
     base.OnDetachingFrom(bindable);
     calendar = null;
 }
        protected override void OnAttachedTo(SampleView bindable)
        {
            base.OnAttachedTo(bindable);
            this.calendar = bindable.Content.FindByName <Syncfusion.SfCalendar.XForms.SfCalendar>("calendar");
            this.calendar.SelectionMode = SelectionMode.MultiSelection;
            var random      = new Random();
            var dates       = new System.Collections.Generic.List <DateTime>();
            var currentDate = DateTime.Now;

            for (int i = 0; i < 6; i++)
            {
                dates.Add(new DateTime(currentDate.Year, currentDate.Month, random.Next(1, 27)));
            }

            this.calendar.SelectedDates = dates;
            this.calendar.MinDate       = DateTime.Now.AddMonths(-5);
            this.calendar.MaxDate       = DateTime.Now.AddMonths(5);
            MonthViewSettings monthSettings = new MonthViewSettings();

            monthSettings.HeaderBackgroundColor = Color.White;
            if (Device.RuntimePlatform == "Android")
            {
                if (Device.Idiom == TargetIdiom.Tablet)
                {
                    monthSettings.SelectionRadius = 25;
                }
                else
                {
                    monthSettings.SelectionRadius = 20;
                }
            }
            else if (Device.RuntimePlatform == "UWP")
            {
                this.calendar.ShowNavigationButtons = true;
            }
            else
            {
                monthSettings.SelectionRadius = 15;
            }

            monthSettings.WeekEndTextColor      = Color.FromHex("#009688");
            monthSettings.InlineBackgroundColor = Color.FromHex("#EEEEEE");
            monthSettings.DateSelectionColor    = Color.FromHex("#EEEEEE");
            monthSettings.TodayTextColor        = Color.FromHex("#2196F3");
            monthSettings.SelectedDayTextColor  = Color.Black;
            this.calendar.MonthViewSettings     = monthSettings;
            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 selectionModePicker = bindable.Content.FindByName <Picker>("selectionModePicker");

            selectionModePicker.SelectedIndex         = 1;
            selectionModePicker.SelectedIndexChanged += SelectionModePicker_SelectedIndexChanged;

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

            viewModePicker.SelectedIndex         = 1;
            viewModePicker.SelectedIndexChanged += ViewModePicker_SelectedIndexChanged;

            var minDatePicker = bindable.Content.FindByName <DatePicker>("minDatePicker");

            minDatePicker.Date          = this.calendar.MinDate;
            minDatePicker.DateSelected += MinDatePicker_DateSelected;

            var maxDatePicker = bindable.Content.FindByName <DatePicker>("maxDatePicker");

            maxDatePicker.Date          = this.calendar.MaxDate;
            maxDatePicker.DateSelected += MaxDatePicker_DateSelected;

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

            navigationDirectionPicker.SelectedIndex         = 0;
            navigationDirectionPicker.SelectedIndexChanged += NavigationDirectionPicker_SelectedIndexChanged;

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

            horizontalLinePicker.SelectedIndex         = 3;
            horizontalLinePicker.SelectedIndexChanged += HorizontalLinePicker_SelectedIndexChanged;
            if (Device.RuntimePlatform != "Android" && Device.RuntimePlatform != "iOS")
            {
                var horizontalLineLabel = bindable.Content.FindByName <Label>("horizontalLineLabel");
                horizontalLineLabel.IsVisible  = false;
                horizontalLinePicker.IsVisible = false;
            }

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

            yearViewPicker.SelectedIndex         = 0;
            yearViewPicker.SelectedIndexChanged += YearViewPicker_SelectedIndexChanged;
        }
Example #22
0
        protected override void OnAttachedTo(SampleView bindable)
        {
            base.OnAttachedTo(bindable);
            this.calendar = bindable.Content.FindByName <Syncfusion.SfCalendar.XForms.SfCalendar>("calendar");
            ObservableCollection <string> customLabels = new ObservableCollection <string> {
                "S", "M", "T", "W", "T", "F", "S"
            };

            this.calendar.CustomDayLabels = customLabels;
            this.calendar.SelectionMode   = SelectionMode.RangeSelection;
            this.calendar.SelectedRange   = new SelectionRange(DateTime.Now.AddDays(-5), DateTime.Now.AddDays(5));
            this.calendar.MinDate         = DateTime.Now.AddMonths(-5);
            this.calendar.MaxDate         = DateTime.Now.AddMonths(5);
            MonthViewSettings monthSettings = new MonthViewSettings();

            monthSettings.HeaderBackgroundColor = Color.White;
            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 == "UWP")
            {
                this.calendar.ShowNavigationButtons = true;
            }
            else
            {
                monthSettings.SelectionRadius = 15;
            }

            monthSettings.HeaderFont            = Font.OfSize("SemiBold", monthSettings.HeaderFont.FontSize);
            monthSettings.WeekEndTextColor      = Color.FromHex("#009688");
            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;
            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 selectionModePicker = bindable.Content.FindByName <Picker>("selectionModePicker");

            selectionModePicker.SelectedIndex         = 2;
            selectionModePicker.SelectedIndexChanged += SelectionModePicker_SelectedIndexChanged;

            var minDatePicker = bindable.Content.FindByName <DatePicker>("minDatePicker");

            minDatePicker.Date          = this.calendar.MinDate;
            minDatePicker.DateSelected += MinDatePicker_DateSelected;

            var maxDatePicker = bindable.Content.FindByName <DatePicker>("maxDatePicker");

            maxDatePicker.Date          = this.calendar.MaxDate;
            maxDatePicker.DateSelected += MaxDatePicker_DateSelected;

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

            navigationDirectionPicker.SelectedIndex         = 0;
            navigationDirectionPicker.SelectedIndexChanged += NavigationDirectionPicker_SelectedIndexChanged;

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

            horizontalLinePicker.SelectedIndex         = 3;
            horizontalLinePicker.SelectedIndexChanged += HorizontalLinePicker_SelectedIndexChanged;
            if (Device.RuntimePlatform != "Android" && Device.RuntimePlatform != "iOS")
            {
                var horizontalLineLabel = bindable.Content.FindByName <Label>("horizontalLineLabel");
                horizontalLineLabel.IsVisible  = false;
                horizontalLinePicker.IsVisible = false;
            }

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

            yearViewPicker.SelectedIndex         = 0;
            yearViewPicker.SelectedIndexChanged += YearViewPicker_SelectedIndexChanged;
        }
        protected override void OnAttachedTo(SampleView bindable)
        {
            base.OnAttachedTo(bindable);
            this.calendar = bindable.Content.FindByName <Syncfusion.SfCalendar.XForms.SfCalendar>("calendar");
            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.SelectionMode = SelectionMode.MultiSelection;
            var random      = new Random();
            var dates       = new System.Collections.Generic.List <DateTime>();
            var currentDate = DateTime.Now;

            for (int i = 0; i < 6; i++)
            {
                dates.Add(new DateTime(currentDate.Year, currentDate.Month, random.Next(1, 27)));
            }

            this.calendar.SelectedDates = dates;
            this.calendar.MinDate       = DateTime.Now.AddMonths(-5);
            this.calendar.MaxDate       = DateTime.Now.AddMonths(5);
            MonthViewSettings monthSettings = new MonthViewSettings();

            monthSettings.HeaderBackgroundColor = Color.White;
            monthSettings.TodayBorderColor      = Color.Transparent;
            if (Device.Idiom == TargetIdiom.Tablet)
            {
                if (Device.RuntimePlatform == "Android")
                {
                    monthSettings.SelectionRadius = 30;
                }
                else
                {
                    monthSettings.SelectionRadius = 15;
                }
            }

            this.calendar.MonthViewSettings = monthSettings;
            if (Device.RuntimePlatform == "UWP")
            {
                this.calendar.ShowNavigationButtons = true;
            }

            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 selectionModePicker = bindable.Content.FindByName <Picker>("selectionModePicker");

            selectionModePicker.SelectedIndex         = 1;
            selectionModePicker.SelectedIndexChanged += SelectionModePicker_SelectedIndexChanged;

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

            viewModePicker.SelectedIndex         = 0;
            viewModePicker.SelectedIndexChanged += ViewModePicker_SelectedIndexChanged;

            var selectionShape = bindable.Content.FindByName <StackLayout>("selectionShape");

            if (Device.RuntimePlatform != "UWP")
            {
                selectionShape.IsVisible = false;
            }
            else
            {
                this.calendar.MonthViewSettings.SelectionShape = SelectionShape.Circle;
            }

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

            selectionShapePicker.SelectedIndex         = 0;
            selectionShapePicker.SelectedIndexChanged += SelectionShapePicker_SelectedIndexChanged;

            var minDatePicker = bindable.Content.FindByName <DatePicker>("minDatePicker");

            minDatePicker.Date          = this.calendar.MinDate;
            minDatePicker.DateSelected += MinDatePicker_DateSelected;

            var maxDatePicker = bindable.Content.FindByName <DatePicker>("maxDatePicker");

            maxDatePicker.Date          = this.calendar.MaxDate;
            maxDatePicker.DateSelected += MaxDatePicker_DateSelected;

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

            navigationDirectionPicker.SelectedIndex         = 0;
            navigationDirectionPicker.SelectedIndexChanged += NavigationDirectionPicker_SelectedIndexChanged;

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

            horizontalLinePicker.SelectedIndex         = 3;
            horizontalLinePicker.SelectedIndexChanged += HorizontalLinePicker_SelectedIndexChanged;
            if (Device.RuntimePlatform != "Android" && Device.RuntimePlatform != "iOS")
            {
                var horizontalLineLabel = bindable.Content.FindByName <Label>("horizontalLineLabel");
                horizontalLineLabel.IsVisible  = false;
                horizontalLinePicker.IsVisible = false;
            }

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

            yearViewPicker.SelectedIndex         = 0;
            yearViewPicker.SelectedIndexChanged += YearViewPicker_SelectedIndexChanged;
        }