Detect spots dragging

7 posts, 0 answers
  1. Christie Admin
    Christie Admin avatar
    239 posts
    Member since:
    Aug 2013

    Posted 20 Jan 2014 Link to this post

    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
  2. Kalin
    Admin
    Kalin avatar
    1209 posts

    Posted 23 Jan 2014 Link to this post

    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Christie Admin
    Christie Admin avatar
    239 posts
    Member since:
    Aug 2013

    Posted 24 Jan 2014 Link to this post

    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
  5. Kalin
    Admin
    Kalin avatar
    1209 posts

    Posted 28 Jan 2014 Link to this post

    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 >>
  6. Christie Admin
    Christie Admin avatar
    239 posts
    Member since:
    Aug 2013

    Posted 28 Jan 2014 in reply to Kalin Link to this post

    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
  7. Christie Admin
    Christie Admin avatar
    239 posts
    Member since:
    Aug 2013

    Posted 28 Jan 2014 in reply to Christie Admin Link to this post

    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
  8. Kalin
    Admin
    Kalin avatar
    1209 posts

    Posted 31 Jan 2014 Link to this post

    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 >>
Back to Top
UI for WPF is Visual Studio 2017 Ready