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.
Unfortunately, activation email could not send to your email. Please try again.

InlineAppointmentTapped Event

Thread ID:

Created:

Updated:

Platform:

Replies:

130384 May 10,2017 08:03 AM Sep 7,2017 06:14 AM Xamarin.Forms 9
loading
Tags: SfSchedule
Kevin
Asked On May 10, 2017 08:03 AM

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 + "\n");

                Debug.WriteLine("starttime = " + startTime + "");
                Debug.WriteLine("viewModel.Items[i].PlannedDT =" + viewModel.Items[i].PlannedDT + "\n");

                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>
  



Subburaj Pandian Veluchamy [Syncfusion]
Replied On May 11, 2017 09:08 AM

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.    


Kevin
Replied On May 11, 2017 09:56 AM

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

Subburaj Pandian Veluchamy [Syncfusion]
Replied On May 12, 2017 12:42 AM

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.     


Kevin
Replied On May 15, 2017 06:00 AM

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?

Subburaj Pandian Veluchamy [Syncfusion]
Replied On May 16, 2017 09:16 AM

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.      


Emil
Replied On June 15, 2017 04:07 PM

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?

Subburaj Pandian Veluchamy [Syncfusion]
Replied On June 16, 2017 05:41 AM

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 


Emil
Replied On September 6, 2017 06:01 PM

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


Subburaj Pandian Veluchamy [Syncfusion]
Replied On September 7, 2017 06:14 AM

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  


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;