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

ConvertDraggedData Issue

2 Answers 63 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Ricardo
Top achievements
Rank 1
Ricardo asked on 15 Dec 2016, 10:43 AM

Hello I'm working with ScheduleView dragging from my ListBox to the ScheduleView I followed the documentation and it works okay.

Now I needed to extend the default class Appointment with my Custom class called CustomVideoAppointment

 public  class CustomVideoAppoiment:Appointment
    {

        public string Name { get; set; }
        public string Path { get; set; }
        public TimeSpan Duration { get; set; }
    
        public bool IsCloud { get; set; }
    }

 

Actually it works just changing the types of my Behavior ScheduleViewCustomDragAndDropBehavior

 public override IEnumerable<IOccurrence> ConvertDraggedData(object data)
        {
            if (Telerik.Windows.DragDrop.Behaviors.DataObjectHelper.GetDataPresent(data, typeof(VideoInfo), false))
            {
                var videos = Telerik.Windows.DragDrop.Behaviors.DataObjectHelper.GetData(data, typeof(VideoInfo), true) as IEnumerable;
                if (videos != null)
                {
                    var item = videos.OfType<VideoInfo>().FirstOrDefault();
                    if (item != null)
                    {
                        var newItem = new CustomVideoAppoiment()
                        {
                            Subject = item.Name,
                            Start = DateTime.Now,
                            End = DateTime.Now.Add(item.Duration),
                            Path = item.Path,
                            Name = item.Name,
                            IsCloud = item.IsCloud
                        };
                        return new List<IOccurrence>() { newItem };
                    }
          
                
                }
            }
            return base.ConvertDraggedData(data);

 

Now when I need to check all the dragged items I see all my custom properties are always null.

 

I attached two images showing the problem. I think is a bug of the control.

 

2 Answers, 1 is accepted

Sort by
0
Ricardo
Top achievements
Rank 1
answered on 15 Dec 2016, 10:50 AM
Here is the another image showing the error.
0
Accepted
Kalin
Telerik team
answered on 15 Dec 2016, 12:00 PM
Hi Ricardo,

When implementing a custom Appointment, you would need to use the approach explained in the following article:
http://docs.telerik.com/devtools/wpf/controls/radscheduleview/features/appointments/custom-appointment#creating-a-custom-appointment-class

You could also check the following example from our online Silverlight demos (the WPF demo uses the same code) that demonstrates a sample implementation of the same scenario:
http://demos.telerik.com/silverlight/#ScheduleView/SchedulingAssistant

Hope this helps.

Regards,
Kalin
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
ScheduleView
Asked by
Ricardo
Top achievements
Rank 1
Answers by
Ricardo
Top achievements
Rank 1
Kalin
Telerik team
Share this question
or