We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

InlineAppointmentTapped Event

Hi, 

I'm trying to implement the InlineAppointmentTapped Event but it's not working with the online documentation.

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;
  



Declaration of the schedule
<StackLayout IsVisible="false" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" x:Name="schedule" >
        <schedule:SfSchedule
            x:Name="sfschedule"
            ScheduleView="MonthView">
        </schedule:SfSchedule>
        </StackLayout>
  



9 Replies

SP Subburaj Pandian Veluchamy Syncfusion Team May 11, 2017 01:08 PM UTC

Hi Kevin, 
 
Thank you for your interest in Syncfusion products. 
 
Based on the provided information, we have prepared sample for your requirement of Schedule MonthInlineAppointmenttapped event in Xamarin Forms, please find the below sample. 
 
Sample link: InlineAppointment_Sample  
  
In the sample, we set display alert in the event, while tapping the InlineAppointment you can get the Appointment details in that.  
 
If the given sample doesn’t meet your requirement, could you please revert to us with more details about requirement with screenshot’s (if possible), it will be helpful for us to check on it and provide you the better solution.  
 
Regards,  
Subburaj Pandian V.    



KE Kevin May 11, 2017 01:56 PM UTC

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;


void Schedule_MonthInlineAppointmentTapped(object sender, MonthInlineAppointmentTappedEventArgs args)
        {
            var appointment = args.Appointment as ScheduleAppointment;
            var date = args.selectedDate;

            DisplayAlert(appointment.Subject, appointment.StartTime.ToString(), "ok", "cancel");

        }


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.


Attachment: scheduleview_page.png_a0bd902.zip


SP Subburaj Pandian Veluchamy Syncfusion Team May 12, 2017 04:42 AM UTC

Hi Kevin,  
 
Thank you for the update. 
 
We have provided the sample for getting tapped appointment details in the InlineView and which has working fine with our end, if your requirement is to open the date (DayView) of the selected appointment you need to set the appointment date in the argument of MonthInlineAppointmenttapped event to the MoveToDate property the SfSchedule. Please refer the below code example, 
 
[c#] 
 
void Schedule_MonthInlineAppointmentTapped(object sender, MonthInlineAppointmentTappedEventArgs args)
        {
            schedule.ScheduleView = ScheduleView.DayView;
            schedule.MoveToDate = (args.Appointment as ScheduleAppointment).StartTime;
        } 
 
 
 
Note: This example is for moving to the specific date of the appointment while tapping the appointment, if your requirement is different please elaborate your requirement clearly with the screenshots.  
 
If you face any issues with the provided solution, could please modify the provided sample to reproduce the issue, along with proper replication procedure and screenshots? So, that we could analyze on it and provide you a better solution. 
 
Regards,   
Subburaj Pandian V.     



KE Kevin May 15, 2017 10:00 AM UTC

Hi, 

Thanks for the reply.
I've got it working thanks to you now. I've an other question. In my scheduleview i have the weeknumbers turned on. Is it posible to add an event, that detects a tap on the weeknumber and opens the corresponding week in a weekview?


SP Subburaj Pandian Veluchamy Syncfusion Team May 16, 2017 01:16 PM UTC

Hi Kevin,   
  
Thank you for the update.  
 
As of now, we don’t have any support to listening while tapping outside the cells (WeekNumber) in Schedule MonthView in Xamarin Forms. Could you please share more details about your requirement of using this feature (listen while tapping WeekNumber) with the required usable cases along with screenshot (if possible), it will be helpful for us to consider while implementing this feature. 
  
Regards,    
Subburaj Pandian V.      



EM Emil June 15, 2017 08:07 PM UTC

it is working when there is an appointment but I would like to change to dayview if there is "no event" but I cant achieve because no action is fired tapping on "no event". How can i make this working?


SP Subburaj Pandian Veluchamy Syncfusion Team June 16, 2017 09:41 AM UTC

Hi Emil, 
 
Your requirement of switching to the Schedule DayView while tapping the Month InlineView, when there is No Appointments in the selected date can be achieved using OnMonthInlineLoadedEvent of Schedule. In the event, you can get the SelectedDate and Appointments, by setting condition of when Appointment count is equal to zero you can set ScheduleView as DayView. Please refer the below code example, 
 
[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
            }
        } 
 
 
We have prepared sample based on this scenario, please find the below sample. 
 
 
Regards, 
Subburaj Pandian V 



EM Emil September 6, 2017 10:01 PM UTC

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



SP Subburaj Pandian Veluchamy Syncfusion Team September 7, 2017 10:14 AM UTC

Hi Emil, 
 
As of now, there is no support available to trigger the event while tapping the Month InlineView “No events”, as we mentioned you can move directly when there is no event on the specific day. You can also show the pop up message when loading the InlineView using OnMonthInlineLoadedEvent of Schedule.  
 
[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
            } 
 
 
MonthInlineAppointmentTapped event of Schedule is available to get the details of the appointment in the InlineView, it will trigger while tapping the inline appointment. You can also refer our online user guide documentation for the same. 
 
 
Regards,  
Subburaj Pandian V  


Loader.
Live Chat Icon For mobile
Up arrow icon