Cannot Drag and Drop Custom Appointments

5 posts, 0 answers
  1. Daniel
    Daniel avatar
    34 posts
    Member since:
    Oct 2011

    Posted 30 Jan 2012 Link to this post

    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).
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 31 Jan 2012 Link to this post

    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 >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Daniel
    Daniel avatar
    34 posts
    Member since:
    Oct 2011

    Posted 31 Jan 2012 Link to this post

    Perfect Yana!! Thanks a lot.
  5. Daniel
    Daniel avatar
    34 posts
    Member since:
    Oct 2011

    Posted 02 Feb 2012 Link to this post

    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.
  6. Daniel
    Daniel avatar
    34 posts
    Member since:
    Oct 2011

    Posted 02 Feb 2012 Link to this post

    Here's my project:

    http://www.mediafire.com/?8m24xd6zxfd8rjy
Back to Top
UI for WPF is Visual Studio 2017 Ready