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

drag and swap

1 Answer 82 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Steven
Top achievements
Rank 1
Steven asked on 14 May 2012, 08:14 AM
Hi,

I'm not sure what I'm attempting is even possible going by this thread:
http://www.telerik.com/community/forums/silverlight/scheduleview/detect-dropping-appointment-on-another.aspx

Basically, I want to be able to drag one appointment onto another one and have specific data on the underlying IAppointment implementation transferred from one appointment to the other and vice-versa.

My issue is being able to get the specific destination appointment when there is more that one appointment filling a particular slot. I want the exact one that the mouse is released upon. Can you please advise if this is possible and if so, how to do it?

FYI., I had tried putting a custom event in my ScheduleViewDragDropBehavior class. The custom event args for this event has a delegate function as a required dependency. The event is fired within the override of the ScheduleViewDragDropBehavior.Drop function. I wanted the code behind of the page that hosts the ScheduleView to invoke my delegate function in the ScheduleViewDragDropBehavior sub-class with the correct destination appointment, but I couldnt get a handle on this whilest dragging the initial appointment. e.g:

 

public delegate void Test(IEnumerable<UIElement> elements);

 

public class DelegateFunctionEventArgs : EventArgs

{

 

public Test DelegateFunction { get; set; }

 

public DelegateFunctionEventArgs(Test delegateFunction)

{

DelegateFunction = delegateFunction;

}

}

 

public class NoResizeScheduleViewDragSwapBehavior : ScheduleViewDragDropBehavior

{

 

public event EventHandler<DelegateFunctionEventArgs> BeginDrop;

 

public override bool CanResize(DragDropState state)

{

 

return false;

}

 

public override bool CanStartResize(DragDropState state)

{

 

return false;

}

 

public override void Drop(DragDropState state)

{

 

if (BeginDrop != null) BeginDrop(this, new DelegateFunctionEventArgs(OnDestinationAppointmentResolved));

 

base.Drop(state);

}

 

private void OnDestinationAppointmentResolved(IEnumerable<UIElement> elements)

{

}

}


In the code behind of the page hosting the ScheduleView I handle the BeginDrop as follows:

 

private void NoResizeScheduleViewDragSwapBehaviorBeginDrop(object sender, DelegateFunctionEventArgs e)

{

  

 

var elements = VisualTreeHelper.FindElementsInHostCoordinates(_p, this);

e.DelegateFunction.Invoke(elements);

}


Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 14 May 2012, 12:49 PM
Hi Steven,

As explained in the forum thread at the moment you cannot find the exact location on which the appointment is dropped.  You can get only the Slot and the appointments in it.

We are sorry for the inconvenience.

All the best,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
ScheduleView
Asked by
Steven
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or