<Grid x:Name="grid_layout">
<syncfusion:SfSchedule
x:Name="schedule"
ScheduleView="WeekView"
DataSource="{Binding ListOfMeeting}"
ShowAppointmentsInline="True"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand" >
<syncfusion:SfSchedule.BindingContext>
<local:AppointmentEditorViewModel/>
</syncfusion:SfSchedule.BindingContext>
</syncfusion:SfSchedule>
<local:EditorLayout x:Name="editorLayout" IsVisible= "false" />
</Grid> |
private void CellTappedEventHandler(object sender, CellTappedEventArgs e)
{
schedule.IsVisible = false;
editorLayout.IsVisible = true;
if (schedule.ScheduleView == ScheduleView.MonthView)
{
//create Appointment
(editorLayout.Behaviors[0] as EditorLayoutBehavior).OpenEditor(null, e.Datetime);
isNewAppointment = true;
}
else
{
if (e.Appointment != null)
{
ObservableCollection<ScheduleAppointment> appointment = new ObservableCollection<ScheduleAppointment>();
appointment = (ObservableCollection<ScheduleAppointment>)schedule.DataSource;
indexOfAppointment = appointment.IndexOf((ScheduleAppointment)e.Appointment);
(editorLayout.Behaviors[0] as EditorLayoutBehavior).OpenEditor((ScheduleAppointment)e.Appointment, e.Datetime);
isNewAppointment = false;
}
else
{
//create Appointment
(editorLayout.Behaviors[0] as EditorLayoutBehavior).OpenEditor(null, e.Datetime);
isNewAppointment = true;
}
}
} |
private void UpdateEditor()
{
if (selectedAppointment != null)
{
eventNameText.Text = selectedAppointment.Subject;
startDatePicker.Date = selectedAppointment.StartTime;
endDatePicker.Date = selectedAppointment.EndTime;
occurrenceButton.Text = (listLayout.Behaviors[0] as ListBehavior).repeatButton.Text;
location.Text = selectedAppointment.Location;
notes.Text = selectedAppointment.Notes;
selectedAppointment.RecurrenceRule = (listLayout.Behaviors[0] as ListBehavior).SelectedAppointment.RecurrenceRule;
if (!selectedAppointment.IsAllDay)
{
startTimePicker.Time = new TimeSpan(selectedAppointment.StartTime.Hour, selectedAppointment.StartTime.Minute, selectedAppointment.StartTime.Second);
endTimePicker.Time = new TimeSpan(selectedAppointment.EndTime.Hour, selectedAppointment.EndTime.Minute, selectedAppointment.EndTime.Second);
switchAllDay.IsToggled = false;
}
else
{
startTimePicker.Time = new TimeSpan(12, 0, 0);
startTimePicker.IsEnabled = false;
endTimePicker.Time = new TimeSpan(12, 0, 0);
endTimePicker.IsEnabled = false;
switchAllDay.IsToggled = true;
}
}
else
{
eventNameText.Text = "";
switchAllDay.IsToggled = false;
startDatePicker.Date = selectedDate;
startTimePicker.Time = new TimeSpan(selectedDate.Hour, selectedDate.Minute, selectedDate.Second);
endDatePicker.Date = selectedDate;
endTimePicker.Time = new TimeSpan(selectedDate.Hour + 1, selectedDate.Minute, selectedDate.Second);
occurrenceButton.Text = "Do not repeat";
location.Text = "";
notes.Text = "";
if ((listLayout.Behaviors[0] as ListBehavior).SelectedAppointment != null)
{
selectedAppointment.RecurrenceRule = (listLayout.Behaviors[0] as ListBehavior).SelectedAppointment.RecurrenceRule;
}
}
} |