/// <summary> /// Begins when the behavior attached to the view. /// </summary> /// <param name="bindable">bindable value</param> protected override void OnAttachedTo(SampleView bindable) { this.scheduleViewButton = ((bindable.Content as Grid).Children[0] as Grid).Children[0] as Button; this.header = ((bindable.Content as Grid).Children[0] as Grid).Children[1] as Label; this.editorButton = ((bindable.Content as Grid).Children[0] as Grid).Children[2] as Button; this.schedule = (bindable.Content as Grid).Children[1] as Syncfusion.SfSchedule.XForms.SfSchedule; this.scheduleViewList = (bindable.Content as Grid).Children[2] as ListView; this.editorLayout = (bindable.Content as Grid).Children[3] as EditorLayout; this.timeZonePicker = bindable.FindByName <Picker>("timeZonePicker"); this.timeZonePicker.ItemsSource = TimeZoneCollection.TimeZoneList; this.timeZonePicker.SelectedIndex = 0; this.timeZonePicker.SelectedIndexChanged += this.TimeZonePicker_SelectedIndexChanged; this.schedule.VisibleDatesChangedEvent += this.Schedule_VisibleDatesChangedEvent; this.schedule.MonthInlineAppointmentTapped += this.Schedule_MonthInlineAppointmentTapped; this.schedule.CellDoubleTapped += this.Schedule_CellDoubleTapped; this.schedule.CellTapped += this.Schedule_CellTapped; this.scheduleViewList.ItemSelected += this.ScheduleViewList_ItemSelected; this.scheduleViewButton.Clicked += this.ScheduleViewButton_Clicked; this.editorButton.Clicked += this.EditorButton_Clicked; (this.editorLayout.BindingContext as EditorLayoutViewModel).AppointmentModified += this.EditorLayout_AppointmentModified; (this.editorLayout.Behaviors[0] as EditorLayoutBehavior).AddEditorElements(); }
/// <summary> /// Begins when the behavior attached to the view. /// </summary> /// <param name="bindable">bindable value</param> protected override void OnAttachedTo(SampleView bindable) { this.scheduleHeaderGrid = ((bindable.Content as Grid).Children[0] as Grid); this.scheduleViewButton = ((bindable.Content as Grid).Children[0] as Grid).Children[0] as Button; this.header = ((bindable.Content as Grid).Children[0] as Grid).Children[1] as Label; this.editorButton = ((bindable.Content as Grid).Children[0] as Grid).Children[2] as Button; this.schedule = (bindable.Content as Grid).Children[1] as Syncfusion.SfSchedule.XForms.SfSchedule; this.scheduleViewList = (bindable.Content as Grid).Children[2] as ListView; this.editorLayout = (bindable.Content as Grid).Children[3] as EditorLayout; this.timeZonePicker = bindable.FindByName <Picker>("timeZonePicker"); this.timeZonePicker.ItemsSource = TimeZoneCollection.TimeZoneList; this.timeZonePicker.SelectedIndex = 0; this.timeZonePicker.SelectedIndexChanged += this.TimeZonePicker_SelectedIndexChanged; this.schedule.VisibleDatesChangedEvent += this.Schedule_VisibleDatesChangedEvent; this.schedule.MonthInlineAppointmentTapped += this.Schedule_MonthInlineAppointmentTapped; this.schedule.CellDoubleTapped += this.Schedule_CellDoubleTapped; this.schedule.CellTapped += this.Schedule_CellTapped; this.scheduleViewList.ItemSelected += this.ScheduleViewList_ItemSelected; this.scheduleViewButton.Clicked += this.ScheduleViewButton_Clicked; this.editorButton.Clicked += this.EditorButton_Clicked; (this.editorLayout.BindingContext as EditorLayoutViewModel).AppointmentModified += this.EditorLayout_AppointmentModified; (this.editorLayout.Behaviors[0] as EditorLayoutBehavior).AddEditorElements(); if (Device.RuntimePlatform == "Android") { this.scheduleHeaderGrid.ColumnDefinitions[0].Width = new GridLength(0.1, GridUnitType.Star); this.header.FontSize = 20; } }
/// <summary> /// Begins when the behavior attached to the view /// </summary> /// <param name="bindable">bindable param</param> protected override void OnDetachingFrom(SampleView bindable) { this.schedule.VisibleDatesChangedEvent -= this.Schedule_VisibleDatesChangedEvent; this.schedule.MonthInlineAppointmentTapped -= this.Schedule_MonthInlineAppointmentTapped; this.schedule.CellDoubleTapped -= this.Schedule_CellDoubleTapped; this.schedule.CellTapped -= this.Schedule_CellTapped; this.scheduleViewList.ItemSelected -= this.ScheduleViewList_ItemSelected; this.scheduleViewButton.Clicked -= this.ScheduleViewButton_Clicked; this.editorButton.Clicked -= this.EditorButton_Clicked; (this.editorLayout.BindingContext as EditorLayoutViewModel).AppointmentModified -= this.EditorLayout_AppointmentModified; this.scheduleViewButton = null; this.header = null; this.editorButton = null; this.schedule = null; this.scheduleViewList = null; this.editorLayout = null; }