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

Cannot Drag and Drop Custom Appointments

4 Answers 226 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 30 Jan 2012, 11:44 AM
Using the following class to manage data conversion between a scheduleview and listbox:

using Telerik.Windows.Controls.ScheduleView;
using Telerik.Windows.DragDrop.Behaviors;
 
namespace DragDrop
{
    public class AppointmentConverter : DataConverter
    {
        /// <summary>
        /// Returns a list of all formats that the data in this data object can be converted to.
        /// </summary>
        public override string[] GetConvertToFormats()
        {
            string assemblyName = typeof(Appointment).AssemblyQualifiedName;
            return new string[] { assemblyName };
        }
 
        /// <summary>
        /// Retrieves a data object in a specified format; the data format is specified by a string.
        /// </summary>
        public override object ConvertTo(object data, string format)
        {
            if (DataObjectHelper.GetDataPresent(data, typeof(ScheduleViewDragDropPayload), false))
            {
                ScheduleViewDragDropPayload payload = (ScheduleViewDragDropPayload)DataObjectHelper.GetData(data, typeof(ScheduleViewDragDropPayload), false);
 
                if (payload != null)
                {
                    return payload.DraggedAppointments;
                }
            }
            return null;
        }
    }
}

I cannot drag a CustomAppointment (as coded in the Telerik Demo)
back to a list box from a schedule view. No exception or error,
it just simply doesn't let me (cursor icon changes to a 'not
permitted' icon).

4 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 31 Jan 2012, 11:15 AM
Hi Daniel,

Please find attached an example which demonstrates how you can implement  drag and drop between RadScheduleView and ListBox.

Hope it helps.

All the best,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Daniel
Top achievements
Rank 1
answered on 31 Jan 2012, 11:25 AM
Perfect Yana!! Thanks a lot.
0
Daniel
Top achievements
Rank 1
answered on 02 Feb 2012, 10:31 AM
Yana, thanks a lot for your solution. It does as I had requested - one thing I have noted though is that in my solution, I can touch down and drag an item from the listbox, but this touch functionality doesn't seem to work with the listbox you have used in your project.

I have made sure both of our list box's data templates and drag drop behaviours are the same so I'm pretty stuck on this now. One of the differences I have noted is the converter class. Any ideas??

Thanks again.
0
Daniel
Top achievements
Rank 1
answered on 02 Feb 2012, 10:44 AM
Here's my project:

http://www.mediafire.com/?8m24xd6zxfd8rjy
Tags
ScheduleView
Asked by
Daniel
Top achievements
Rank 1
Answers by
Yana
Telerik team
Daniel
Top achievements
Rank 1
Share this question
or