protected override void OnAttachedTo(SampleView bindable) { if (bindable == null) { return; } base.OnAttachedTo(bindable); schedule = bindable.Content.FindByName <Syncfusion.SfSchedule.XForms.SfSchedule>("Schedule"); if (schedule?.Locale == "ja") { localizationViewModel = new LocalizationViewModel(); localePicker = bindable.PropertyView.FindByName <Picker>("localePicker"); if (localePicker == null) { return; } localePicker.SelectedIndex = 0; localePicker.SelectedIndexChanged += LocalePicker_SelectedIndexChanged; schedule.DataSource = localizationViewModel.JapaneseAppointments; } viewPicker = bindable.PropertyView.FindByName <Picker>("viewPicker"); if (viewPicker == null) { return; } if (bindable.GetType().Equals(typeof(RecursiveAppointments))) { viewPicker.SelectedIndex = 3; } else if (bindable.GetType().Equals(typeof(ViewCustomization))) { viewPicker.SelectedIndex = 3; } else if (bindable.GetType().Equals(typeof(Localization))) { viewPicker.SelectedIndex = 1; } else { viewPicker.SelectedIndex = 2; } viewPicker.SelectedIndexChanged += ViewPicker_SelectedIndexChanged; }
/// <summary> /// Begins when the behavior attached to the view /// </summary> /// <param name="bindable">bindable value</param> protected override void OnAttachedTo(SampleView bindable) { if (bindable == null) { return; } base.OnAttachedTo(bindable); this.schedule = bindable.Content.FindByName <Syncfusion.SfSchedule.XForms.SfSchedule>("Schedule"); this.currentTime = bindable.FindByName <Switch>("currentTime"); this.showCurrentTime = bindable.FindByName <Label>("showCurrentTime"); if (Device.RuntimePlatform == Device.Android) { this.schedule.ViewHeaderStyle.DateFontSize = 24; } if (this.schedule?.Locale == "ja") { this.localizationViewModel = new LocalizationViewModel(); this.localePicker = bindable.FindByName <Picker>("localePicker"); if (this.localePicker == null) { return; } this.localePicker.SelectedIndex = 0; this.localePicker.SelectedIndexChanged += this.LocalePicker_SelectedIndexChanged; this.schedule.DataSource = this.localizationViewModel.JapaneseAppointments; } this.viewPicker = bindable.FindByName <Picker>("viewPicker"); if (this.viewPicker == null) { return; } if (bindable.GetType().Equals(typeof(RecursiveAppointments))) { this.viewPicker.SelectedIndex = 3; switch (Device.RuntimePlatform) { case Device.iOS: this.schedule.MonthViewSettings.AppointmentDisplayMode = AppointmentDisplayMode.Appointment; if (Device.RuntimePlatform == Device.iOS && Device.Idiom == TargetIdiom.Tablet) { schedule.MonthViewSettings.AppointmentIndicatorCount = 4; } else if (Device.RuntimePlatform == Device.iOS) { schedule.MonthViewSettings.AppointmentIndicatorCount = 2; } break; case Device.Android: this.schedule.MonthViewSettings.AppointmentDisplayMode = AppointmentDisplayMode.Appointment; break; case Device.UWP: this.schedule.MonthViewSettings.AppointmentDisplayMode = AppointmentDisplayMode.Indicator; break; case Device.WPF: this.schedule.MonthViewSettings.AppointmentDisplayMode = AppointmentDisplayMode.Indicator; break; } } else if (bindable.GetType().Equals(typeof(ViewCustomization))) { this.viewPicker.SelectedIndex = 3; } else if (bindable.GetType().Equals(typeof(Localization))) { this.schedule.MonthViewSettings.AppointmentDisplayMode = AppointmentDisplayMode.Appointment; this.schedule.MonthViewSettings.AppointmentDisplayCount = 2; if (Device.RuntimePlatform == Device.iOS && Device.Idiom == TargetIdiom.Tablet) { schedule.MonthViewSettings.AppointmentIndicatorCount = 4; } else if (Device.RuntimePlatform == Device.iOS) { schedule.MonthViewSettings.AppointmentIndicatorCount = 2; } this.viewPicker.SelectedIndex = 3; } else { switch (Device.RuntimePlatform) { case Device.iOS: schedule.ScheduleView = ScheduleView.MonthView; if (Device.Idiom == TargetIdiom.Tablet) { schedule.MonthViewSettings.AppointmentIndicatorCount = 4; } else { schedule.MonthViewSettings.AppointmentIndicatorCount = 2; } this.viewPicker.SelectedIndex = 3; break; case Device.Android: schedule.ScheduleView = ScheduleView.MonthView; this.viewPicker.SelectedIndex = 3; break; case Device.UWP: schedule.ScheduleView = ScheduleView.WeekView; this.viewPicker.SelectedIndex = 1; break; case Device.WPF: schedule.ScheduleView = ScheduleView.WeekView; this.viewPicker.SelectedIndex = 1; break; } } if (bindable.GetType().Equals(typeof(GettingStarted))) { schedule.ScheduleView = ScheduleView.WeekView; this.viewPicker.SelectedIndex = 1; this.currentTime.Toggled += CurrentTime_Toggled; switch (Device.RuntimePlatform) { case Device.iOS: schedule.ShowAppointmentsInline = true; break; case Device.Android: schedule.ShowAppointmentsInline = true; this.showCurrentTime.FontSize = 18; this.showCurrentTime.TextColor = Color.Gray; break; case Device.UWP: schedule.ShowAppointmentsInline = false; schedule.MonthViewSettings.ShowAgendaView = false; this.showCurrentTime.TextColor = Color.Black; break; case Device.WPF: schedule.ShowAppointmentsInline = false; schedule.MonthViewSettings.ShowAgendaView = false; break; } } this.viewPicker.SelectedIndexChanged += this.ViewPicker_SelectedIndexChanged; }