Sean Overman
Top achievements
Rank 1
Sean Overman
asked on 12 Apr 2011, 05:18 PM
How can I cancel the appointment dragging once its started? For example by pressing the escape key.
3 Answers, 1 is accepted
0
Hi Sean Overman,
Thank you for your question.
Here is how this could be achieved:
I hope this is helpful. Feel free to ask if you have any additional questions.
Greetings,
Ivan Todorov
the Telerik team
Thank you for your question.
Here is how this could be achieved:
//...
this
.radScheduler1.KeyDown +=
new
KeyEventHandler(radScheduler1_KeyDown);
this
.radScheduler1.SchedulerElement.DragDropBehavior.AppointmentDropping +=
new
EventHandler<AppointmentMovingEventArgs>(DragDropBehavior_AppointmentDropping);
//...
private
bool
shouldCancelDrop =
false
;
void
DragDropBehavior_AppointmentDropping(
object
sender, AppointmentMovingEventArgs e)
{
e.Cancel =
this
.shouldCancelDrop;
}
void
radScheduler1_KeyDown(
object
sender, KeyEventArgs e)
{
if
(e.KeyCode == Keys.Escape)
{
this
.shouldCancelDrop =
true
;
SchedulerVisualElement parent =
this
.radScheduler1.SchedulerElement.DragDropBehavior.ActiveFeedback.Parent
as
SchedulerVisualElement;
this
.radScheduler1.SchedulerElement.DragDropBehavior.Drop();
foreach
(AppointmentElement element
in
SchedulerUIHelper.GetAppointmentElements(
this
.radScheduler1))
{
element.Capture =
false
;
}
this
.radScheduler1.SchedulerElement.DragDropBehavior.RemoveFeedback(parent);
this
.shouldCancelDrop =
false
;
}
}
I hope this is helpful. Feel free to ask if you have any additional questions.
Greetings,
Ivan Todorov
the Telerik team
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 Public Issue Tracking
system and vote to affect the priority of the items
0
Sean Overman
Top achievements
Rank 1
answered on 13 Apr 2011, 08:37 PM
Thank you for the code example, how this fails to function correctly when using grouping by resource: GroupType.Resource
You can see the problem by adding this bit of code to your example (form_load):
You can see the problem by adding this bit of code to your example (form_load):
Telerik.WinControls.UI.Resource res = new Telerik.WinControls.UI.Resource();
res.Id = new EventId(1);
res.Name = "test emp";
radScheduler1.Resources.Add(res);
radScheduler1.GroupType = GroupType.Resource;
0
Hi Sean Overman,
The dragging logic is a bit different when you are using grouping by resource since the appointments can be dragged between different view elements. I have tried to modify the code to work when grouping is enabled, however the public API of RadScheduler does not allow it. This scenario makes sense and we will consider improving our API in when planning our future releases.
If you have any additional questions, do not hesitate to ask.
Best wishes,
Ivan Todorov
the Telerik team
The dragging logic is a bit different when you are using grouping by resource since the appointments can be dragged between different view elements. I have tried to modify the code to work when grouping is enabled, however the public API of RadScheduler does not allow it. This scenario makes sense and we will consider improving our API in when planning our future releases.
If you have any additional questions, do not hesitate to ask.
Best wishes,
Ivan Todorov
the Telerik team
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 Public Issue Tracking
system and vote to affect the priority of the items