This is a migrated thread and some comments may be shown as answers.

Suspected Bug: IAppointment.Copy IAppointment.AppointmentCopyFrom

2 Answers 55 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 12 Apr 2011, 04:47 AM
I have a class that extends Appointment like so:
public class AppointmentTaskVm : Appointment
{
  private int _appointmentTaskId;
  private bool _isBasketItem;
  private int _position;
  private int? _taskId;
  public int AppointmentTaskId
  {
    get { return _appointmentTaskId; }
    set
    {
      _appointmentTaskId = value;
      OnPropertyChanged("AppointmentTaskId");
    }
  }
  public bool IsBasketItem
  {
    get { return _isBasketItem; }
    set
    {
      _isBasketItem = value;
      OnPropertyChanged("IsBasketItem");
    }
  }
  public int Position
  {
    get { return _position; }
    set
    {
      _position = value;
      OnPropertyChanged("Position");
    }
  }
  public int? TaskId
  {
    get { return _taskId; }
    set
    {
      _taskId = value;
      OnPropertyChanged("TaskId");
    }
  }
  public override IAppointment Copy()
  {
    var newAppointment = new AppointmentTaskVm();
    newAppointment.CopyFrom(this);
    return newAppointment;
  }
  public override void CopyFrom(IAppointment other)
  {
    var task = other as AppointmentTaskVm;
    if (task != null)
    {
      AppointmentTaskId = task.AppointmentTaskId;
      IsBasketItem = task.IsBasketItem;
      Position = task.Position;
      TaskId = task.TaskId;
    }
    base.CopyFrom(other);
  }
}

Dragging the AppointmentTaskVm from a ListBox to the ScheduleView causes the Copy and CopyFrom to fire multiple times. This results in the additional properties in the AppointmentTaskVm to loose thier values.

Subscribing to the AppointmentCreated event of the ScheduleView shows that the new AppointmentTaskVm additional properties are initialised with default values (instead of copying the values from the original AppointmentTaskVm).


2 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 15 Apr 2011, 04:21 PM
Hi David,

I apologize for the delayed reply. I suppose that RadScheduleView is initially empty and when you drag an appointment from the list box the AppointmentCreated event is fired. This is a result from our workaround for a bug in the WPF ListCollectionView. In the past week we changed this functionality, so most probably we affected your application and I would strongly recommend trying with the assemblies from the upcoming service pack release early next week. If the problem persists, please, send us a simple application that could be used to observe and debug the problem.

Regards,
Valeri Hristov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
David
Top achievements
Rank 1
answered on 16 Apr 2011, 01:15 AM
Okay I'll wait for the service pack next week and see if this fixes the issue.
Tags
ScheduleView
Asked by
David
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
David
Top achievements
Rank 1
Share this question
or