Skip to content

This repository contains a sample on How to enable drag and drop for custom appointments in the Syncfusion Xamarin.Forms Schedule (SfSchedule)?

Notifications You must be signed in to change notification settings

SyncfusionExamples/custom-appointment-draganddrop-schedule-xamarin-android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

How to enable drag and drop for custom appointments in Xamarin.Android Schedule(SfSchedule)

You can enable drag and drop for custom appointments in SfSchedule by implementing the INotifyPropertyChanged for your event.

Implements the INotifyPropertyChanged in custom appointment class and raise property changed notifier for all the properties used for appointment mapping.

public class Meeting : INotifyPropertyChanged
{
        private string eventname;
        private Calendar from;
        private Calendar to;
        private bool isAllDay;
        private int color;
 
        public string EventName
        {
            get { return eventname; }
            set
            {
                eventname = value;
                this.RaisePropertyChanged("EventName");
            }
        }
 
        public Calendar From
        {
            get { return from; }
            set
            {
                from = value;
                this.RaisePropertyChanged("From");
            }
        }
 
        public Calendar To
        {
            get { return to; }
            set
            {
                to = value;
                this.RaisePropertyChanged("To");
            }
        }
 
        public bool IsAllDay
        {
            get { return isAllDay; }
            set
            {
                isAllDay = value;
                this.RaisePropertyChanged("IsAllDay");
            }
        }
 
        public int Color
        {
            get { return color; }
            set
            {
                color = value;
                this.RaisePropertyChanged("Color");
            }
        }
 
        public event PropertyChangedEventHandler PropertyChanged;
 
        private void RaisePropertyChanged(String property)
        {
            if (this.PropertyChanged != null)
                this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs(property));
        }  
}

Enable appointment drag and drop support in schedule using AllowAppointmentDrag property of Schedule.

schedule.AllowAppointmentDrag = true;

Map the custom appointment properties with the SfSchedule using AppointmentMapping.

AppointmentMapping dataMapping = new AppointmentMapping();
dataMapping.Subject = "EventName";
dataMapping.StartTime = "From";
dataMapping.EndTime = "To";
dataMapping.Color = "Color";
dataMapping.IsAllDay = "IsAllDay";
schedule.AppointmentMapping = dataMapping;

About

This repository contains a sample on How to enable drag and drop for custom appointments in the Syncfusion Xamarin.Forms Schedule (SfSchedule)?

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages