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

Detect spots dragging

6 Answers 70 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Christie Admin
Top achievements
Rank 1
Christie Admin asked on 20 Jan 2014, 07:14 PM
Hi,

when the user use CTRL + Drag&Drop to duplicate appointments, I would like to know how I can raise a custom event with all new duplicated appointments...

Thank's
Alain

6 Answers, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 23 Jan 2014, 10:16 AM
Hi Alain,

What I can suggest you is that you implement a custom ScheduleView DragDropBehavior. Inside of the implementation you can override the Drop method and check whether the control was pressed when the Drop was performed. Then you can get the Start time of the state.DestinationSlots - this way you will know where the new Appointmets are placed and in the overridden DragDropCompleted method you can get the newly created Appointments by their times in state.DestinationAppointmentsSource. You can also check this article for more details about the ScheduleView DragDropBehavior methods.

public override void Drop(DragDropState state)
{
    if (state.IsControlPressed)
    {
        // get the new times in state.DestinationSlots
    }
             
    base.Drop(state);
}

Hope this helps.

Regards,
Kalin
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Christie Admin
Top achievements
Rank 1
answered on 24 Jan 2014, 02:59 PM
Hi Kalin,

just to be sure we understand each other... I have a usercontrol which contain a RadScheduleView. If I drag multiple spots using the CTRL key, when I release the key, new spots are created and an AppointmentCreated event are raised for each new created spots. I'm trying to create a custom event which will be raise on the last AppointmentCreated event raised by the RadScheduleView. My custom event wil contain all new created spots. Your suggestion will be fine for this situation?

Thank's
Alain
0
Kalin
Telerik team
answered on 28 Jan 2014, 02:30 PM
Hello Alain,

The DragDropCompleted method from the ScheduleView DragDropManager is called right after all of the AppointmentCreated events for the new Appointments are fired. So you could successfully use the approach I have suggested you in the previous post in order to extract them all and implement custom logic there.

Hope this helps. If you have any concerns about the implementation feel free to contact us.

Regards,
Kalin
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Christie Admin
Top achievements
Rank 1
answered on 28 Jan 2014, 09:27 PM
Wonderfull :)

One last thing, I'm not sure how to handle this... I mean, I already implemented a CustomDragDropBehavior

        public override void DragDropCompleted(DragDropState state)
        {

            // Doing my stufff

            base.DragDropCompleted(state);
        }

but I'm not sure how I can access the values within my CustomDragDropBehavior

Thank's
Alain
0
Christie Admin
Top achievements
Rank 1
answered on 28 Jan 2014, 11:00 PM
Regarding my previous post...

In my usercontrol which contain a ScheduleView control, I would like to raise an event with all new created appointments so, I created a CustomDragDropBehavior and I wish to know what I have to do in my usercontrol to catch the DragDropCompleted in my CustomDragDropBehavior to raise my event with the values I got in the DragDropCompleted ?!?

Thank's
Alain
0
Kalin
Telerik team
answered on 31 Jan 2014, 01:41 PM
Hello Alain,

What you need to do is to define a RoutedEvent inside of the UserControl and to raise it inside of the DragDropCompleted method. You can do that adding a property inside of the CustomDragDropBehavior which will hold the instance of the UserControl and you will be able to raise the event the following way:

this.CustomUserControl.RaiseEvent(new RoutedEventArgs(CustomUserControl.CustomEvent));

For your convenience I have prepared a sample project which demonstrates the exact approach - when you drag and drop appointment with the control key pressed a MessageBox will appear.

Hope this will help you to achieve the desired.

Regards,
Kalin
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
ScheduleView
Asked by
Christie Admin
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Christie Admin
Top achievements
Rank 1
Share this question
or