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

Appointment allignment after drag and drop

4 Answers 45 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
johannb
Top achievements
Rank 1
johannb asked on 14 Oct 2015, 02:18 PM

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

 

 

4 Answers, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 19 Oct 2015, 08:30 AM
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
0
Kalin
Telerik team
answered on 19 Oct 2015, 03:04 PM
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
0
Johann Bester
Top achievements
Rank 1
answered on 21 Oct 2015, 12:06 PM

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
    }

0
Kalin
Telerik team
answered on 22 Oct 2015, 06:31 AM
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
Tags
ScheduleView
Asked by
johannb
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Johann Bester
Top achievements
Rank 1
Share this question
or