BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
sfschedule.MonthInlineAppointmentTapped += (object sender, MonthInlineAppointmentTappedEventArgs args) => { var appointment = args.selectedAppointment; var date = args.selectedDate; }; |
code for adding appointments
ScheduleAppointmentCollection appointmentCollection = new ScheduleAppointmentCollection(); for (int i = 0; i < viewModel.Items.Count; i++) { ScheduleAppointment appointment = new ScheduleAppointment(); //DateTime startTime = viewModel.Items[i].PlannedDT; //DateTime endTime = viewModel.Items[i].PlannedDT.AddHours(1); DateTime startTime = new DateTime(viewModel.Items[i].PlannedDT.Year, viewModel.Items[i].PlannedDT.Month, viewModel.Items[i].PlannedDT.Day, 10, 0, 0); DateTime endTime = new DateTime(viewModel.Items[i].PlannedDT.Year, viewModel.Items[i].PlannedDT.Month, viewModel.Items[i].PlannedDT.Day, 12, 0, 0); startTime = startTime.AddMonths(4); endTime = endTime.AddMonths(4); appointment.IsAllDay = true; appointment.StartTime = startTime; appointment.EndTime = endTime; appointment.Color = viewModel.Items[i].Color; appointment.Subject = viewModel.Items[i].Name; Debug.WriteLine("Added " + viewModel.Items[i].Name + " to schedule"); Debug.WriteLine("With date " + startTime + ""); Debug.WriteLine("starttime = " + startTime + ""); Debug.WriteLine("viewModel.Items[i].PlannedDT =" + viewModel.Items[i].PlannedDT + ""); appointmentCollection.Add(appointment); } sfschedule.DataSource = appointmentCollection; |
<StackLayout IsVisible="false" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" x:Name="schedule" > <schedule:SfSchedule x:Name="sfschedule" ScheduleView="MonthView"> </schedule:SfSchedule> </StackLayout> |
Hi there,
Thanks for the fast reply.
I've tried the sample code but it still doesn't work. If added a screenshot like asked.Added this to the original code.
sfschedule.MonthInlineAppointmentTapped += Schedule_MonthInlineAppointmentTapped;
}
By pressing a date the scheduler need to open that date. This happens in the sample even if there isn't a event that day. But this doesn't work in my project. It doesn't open the day with or without a appointment.
DateTime minDate = new DateTime(2017, 1, 1, 0, 0, 0);
sfschedule.MinDisplayDate = minDate;
DateTime maxDate = currentDate.AddYears(3);
sfschedule.MaxDisplayDate = maxDate;
MonthViewSettings monthViewSettings = new MonthViewSettings();
monthViewSettings.ShowWeekNumber = true;
sfschedule.MonthViewSettings = monthViewSettings;
sfschedule.HeaderStyle.TextSize = 15;
some customization I've added to the schedule.
[c#]
void Schedule_MonthInlineAppointmentTapped(object sender, MonthInlineAppointmentTappedEventArgs args)
{ schedule.ScheduleView = ScheduleView.DayView; schedule.MoveToDate = (args.Appointment as ScheduleAppointment).StartTime; } |
[c#]
schedule.OnMonthInlineLoadedEvent += Schedule_OnMonthInlineLoadedEvent;
…
void Schedule_OnMonthInlineLoadedEvent(object sender, MonthInlineLoadedEventArgs args)
{ var appointment = args.appointments as ScheduleAppointmentCollection; if (appointment.Count == 0) { schedule.ScheduleView = ScheduleView.DayView; } else { // perform functions based on your requirement } } |
Hi,
provided code above works fine but I have a different question. if I use provided sample, it directly goes to dayview
what I want is, i want to display inline that "no appointment" and then let the user click inline again to switch to dayview.
is it possible? I see that no event is fired tapping into "no apointment" but maybe I can customize by adding a button or image with gesture inside?
thanks,
Emil
[c#]
var appointments = (args.appointments as IList);
if (appointments == null || appointments.Count == 0) { DisplayAlert("No Appointments", "count 0", "OK"); schedule.ScheduleView = ScheduleView.DayView; } else { // perform fuction for Appointments } |