Completed
Last Updated: 16 Aug 2017 08:13 by ADMIN
ADMIN
Hristo
Created on: 14 Jul 2017 15:27
Category: Scheduler/Reminder
Type: Bug Report
1
FIX. RadScheduler - changing an item in the data source object and receiving ItemChanged notification in RadScheduler should update the item in the control
How  to reproduce: public partial class Form2 : Form
{
    BindingList<AppointmenntObject> appointments;
    BindingSource bs;

    public Form2()
    {
        InitializeComponent();

        this.appointments = new BindingList<AppointmenntObject>();

        this.bs = new BindingSource();
        this.bs.DataSource = this.appointments;
        for (int i = 0; i <= 3; i++)
        {
            appointments.Add(new AppointmenntObject(DateTime.Now.AddDays(i), DateTime.Now.AddDays(i).AddHours(2), "Summary " + i, "Description" + i, "Location" + i));
        }

        AppointmentMappingInfo appointmentMappingInfo = new AppointmentMappingInfo();
        appointmentMappingInfo.Start = "Start";
        appointmentMappingInfo.End = "End";
        appointmentMappingInfo.Description = "Description";
        appointmentMappingInfo.Summary = "Summary";
        this.schedulerBindingDataSource1.EventProvider.Mapping = appointmentMappingInfo;
        schedulerBindingDataSource1.EventProvider.DataSource = this.bs;

        this.radScheduler1.DataSource = this.schedulerBindingDataSource1;
    }

    private void button1_Click(object sender, EventArgs e)
    {
        var ev = (AppointmenntObject)this.bs.Current;
        var end = ev.End;
        ev.End = end.AddHours(1);
    }
}

public class AppointmenntObject : INotifyPropertyChanged
    {
        private DateTime start;
        private DateTime end;
        private string summary;
        private string description;
        private string location;

        public AppointmenntObject(DateTime start, DateTime end, string summary, string description, string location)
        {
            this.Start = start;
            this.End = end;
            this.Summary = summary;
            this.Description = description;
            this.Location = location;
        }

        public DateTime Start
        {
            get
            {
                return this.start;
            }
            set
            {
                if (this.start != value)
                {
                    this.start = value;
                    OnPropertyChanged("Start");
                }
            }
        }


        public DateTime End
        {
            get
            {
                return this.end;
            }
            set
            {
                if (this.end != value)
                {
                    this.end= value;
                    OnPropertyChanged("end");
                }
            }
        }

        public string Description
        {
            get
            {
                return this.description;
            }
            set
            {
                if (this.description != value)
                {
                    this.description = value;
                    OnPropertyChanged("Description");
                }
            }
        }

        public string Summary
        {
            get
            {
                return this.summary;
            }
            set
            {
                if (this.summary != value)
                {
                    this.summary= value;
                    OnPropertyChanged("Summary");
                }
            }
        }

        public string Location
        {
            get
            {
                return this.location;
            }
            set
            {
                if (this.location != value)
                {
                    this.location = value;
                    OnPropertyChanged("Location");
                }
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }

Workaround: Rebind the SchedulerBindingDataSource object

private void button1_Click(object sender, EventArgs e)
{
    var ev = (AppointmenntObject)this.bs.Current;
    var end = ev.End;
    ev.End = end.AddHours(1);

    this.schedulerBindingDataSource1.Rebind();
}
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments