Appointment allignment after drag and drop

5 posts, 0 answers
  1. johannb
    johannb avatar
    1 posts
    Member since:
    Feb 2013

    Posted 14 Oct 2015 Link to this post

    Hi,

     

    In my View using the RadScheduleView control The drag and drop of appointments aligns next to each other even though the appoints do not fall in the same time span/slot.

    Example:

    Appointment 1 06:00 - 06:30

    Appointment 2 06:30 - 07:00​

    Now drag Appointment 2 to start at 05:30 and then again drag Appointment 1 to start at 05:00. You will see that the appointments appear next to each other although they do not occur in the same time slot. The expectation is that it should occur one after the other. They should only appear next to each other if the second appointment starts during the first appointment

    See attached files for result. Also note that I could reconstruct this on the Telerik Controls Demo site: http://demos.telerik.com/silverlight/#ScheduleView/FirstLook

     

     

  2. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 19 Oct 2015 Link to this post

    Hi Johann,

    We managed to reproduce the explained behavior. However we will need some more time in order to further investigate - I will get back to with more information as soon as possible.

    Thanks for understanding.

    Regards,
    Kalin
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
  4. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 19 Oct 2015 Link to this post

    Hi Johann,

    The observed behavior is caused by the exact Start/End times of the appointments. Actually while dragging you are changing the seconds of those times as well. So this can end up in such scenario where the End of an appointment is taking couple of seconds more than the displayed time and going a little bit inside of the slot of the next appointment. However you can easily workaround that behavior by either always removing the seconds and the milliseconds of the dropped appointment using custom ScheduleView DragDropBehavior or by implementing custom SnapBehavior that snaps by single minute. For the SnapBehavior you can use the approach explained in the following article (just change minutes from 5 to 1) and you should be able to achieve the desired behavior:
    http://docs.telerik.com/devtools/wpf/controls/radscheduleview/features/appointments/snapappointments#customizing-the-snapbehavior

    Hope this helps.

    Regards,
    Kalin
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  5. Johann Bester
    Johann Bester avatar
    1 posts
    Member since:
    Sep 2009

    Posted 21 Oct 2015 in reply to Kalin Link to this post

    Hi Kalin,

    Thank you for the work around. The snap behavior does the trick. I only wanted to snap to 1 minute(s) so I refactored the behavior you supplied in the link. See below for my implementation.

     

     

        public class RadScheduleViewMinuteSnapBehaviour : SnapBehavior
        {
            #region Methods

            public override DateTime SnapEnd(SnapData snapData, DateTime snappedTime)
            {
                return StripSeconds(snappedTime);
            }

            public override DateTime SnapStart(SnapData snapData, DateTime snappedTime)
            {
                return StripSeconds(snappedTime);
            }

            public DateTime StripSeconds(DateTime snappedTime)
            {
                long secondsRemainderInTicks = snappedTime.Ticks % TimeSpan.FromMinutes(1).Ticks;

                return snappedTime.AddTicks(-secondsRemainderInTicks);
            }

            #endregion
        }

  6. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 22 Oct 2015 Link to this post

    Hello Johann,

    I'm glad you have managed to achieve the desired. If you have any other questions or concerns, please let us know.

    Regards,
    Kalin
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top
DevCraft banner