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

Detexting if I am on the same slot

2 Answers 69 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 10 Apr 2014, 01:21 PM
Hi,

I created a UserControl based on a ScheduleView. My UserControl offer an OnCanDrop event so I implemented a DragDropCustomBehavior to reach my goal. In the CanDrop override method of my DragDropBehavior, I don't want to raise my event when I'm over the appointment I'm dragging...

Thank's
Alain

2 Answers, 1 is accepted

Sort by
0
Christie Admin
Top achievements
Rank 1
answered on 10 Apr 2014, 02:37 PM
Hi,

I need to reformulate my post :)

I have a UserControl which contain a ScheduleView, my UserControl provide a "OnCanDrag" event and I want my event to be fire only once when I enter in a new slot, I don't want my event to be fire as many time as I move in the new slot.

Thank's
Alain
0
Kalin
Telerik team
answered on 14 Apr 2014, 02:35 PM
Hello Alain,

You could achieve the desired if you set the SnapAppointments property of the ScheduleView to true and keep the current destination Slot in the custom DragDropBehavior. This way will be able to do custom logic only when the destination slot has changed. Please check the following code snippet:

private Slot slot = new Slot();
public override bool CanDrop(DragDropState state)
{
    var destinationSlot = state.DestinationSlots.First();
 
    if (!destinationSlot.Equals(this.slot))
    {
        this.slot = destinationSlot;
        Debug.WriteLine(destinationSlot);
    }
 
    return base.CanDrop(state);
}

However if this doesn't help, I'll ask you to share some more details on the exact scenario and requirements.

I'm looking forward to hearing from you.

Regards,
Kalin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
ScheduleView
Asked by
Christie Admin
Top achievements
Rank 1
Answers by
Christie Admin
Top achievements
Rank 1
Kalin
Telerik team
Share this question
or