Completed
Last Updated: 06 Jun 2014 14:41 by ADMIN
ADMIN
George
Created on: 31 Jan 2014 13:20
Category: Scheduler/Reminder
Type: Bug Report
0
FIX. RadScheduler - Setting ResourceId to an appointment and then editing that appointment with the SchedulerEditDialog fires the CollectionChangedEvent of the Appointments collection
To reproduce:

Add a Resource to RadScheduler:

Resource res = new Resource();
res.Id = new EventId(199);
res.Name = "John Doe";

radScheduler1.Resources.Add(res);

Create a new appointment and set the resource:

Appointment app = new Appointment();

app.Start = DateTime.Now;
app.End = app.Start.AddHours(1);
app.BackgroundId = 3;
app.ResourceId = new EventId(199);

radScheduler1.Appointments.Add(app);

Subscribe to the CollectionChangedEvent:
void Appointments_CollectionChanged(object sender, Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e)
{
    if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.ItemChanged)
    {
        Debug.WriteLine("Property Changed = " + e.PropertyName);
    }
}

Run the application, open the appointment and click ok. You will notice that the event will fire. It should not fire since the EventId is the same.

Workaround:
Create a custom appointment following this article: http://www.telerik.com/help/winforms/scheduler-appointments-and-dialogs-adding-a-custom-field-to-the-editappointment-dialog.html and override the ResourceId property:

public class App : Appointment
{
    public override EventId ResourceId
    {
        get
        {
            return base.ResourceId;
        }
        set
        {
            if (!Object.Equals(this.ResourceId, value))
            {
                base.ResourceId = value;
            }
        }
    }
}
0 comments