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

Drag and drop help

11 Answers 116 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
hardik
Top achievements
Rank 1
hardik asked on 26 Apr 2011, 06:26 AM
Hi telerik,

I am using custom drag and drop class. I want to cancel the drag and drop in week and month view.

 public override bool CanStartDrag(DragDropState state)
    {      
      Some condition to check view mode. and as per that i return true or false.
       return base.CanStartDrag(state);
    }

But in this class how can I know the view mode?

Thanks
Hardik

11 Answers, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 28 Apr 2011, 10:01 AM
Hello Hardik,

In order to get the view definition you can do the following:
- create an attached property in your drag-n-drop behaviour
- bind this property to the view definition.

In that way you will be able to get the view definition and use it in your class.

Please let us know if that was helpful.

Best wishes,
Konstantina
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
hardik
Top achievements
Rank 1
answered on 20 May 2011, 09:44 AM
Hi telerik,

I want to restrict the user to drag the appointment which is of another resource. Like in day mode 10 resources are selected.

Now resource1 appointment can't be drag to resource2.  For that I think one logic is that  while dragging the appointment at that time I stored the Id of that particular resource whose appointment I am dragging.

 And when drop event is called at that time any how I will find the resource Id where the appointment is dropped. And then compare these two resource ID. if they don't match I will cancel the drag.

Bot the problem is how can I get the resource Id where I drop the appointment. Is there any property from where I can get the information of resource where I drop the appointment.

Thanks
Hardik
0
Valeri Hristov
Telerik team
answered on 20 May 2011, 10:17 AM
Hello hardik,

The slot where the appointmes are going to be dropped can be accessed from the DragDropState.TargetAreas property. I would suggest checking this property in the CanDrop method.

Kind regards,
Valeri Hristov
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
hardik
Top achievements
Rank 1
answered on 23 May 2011, 07:30 AM
Thanks for the reply.

Sorry to say but I am not able to get the property as you defined in your answer.

I have check it as per your answer.


Thanks
Hardik
0
Valeri Hristov
Telerik team
answered on 25 May 2011, 09:21 AM
I apologize for misleading you. I was referring the DestinationSlots property:
override bool CanDrop(DragDropState state)
{
    var slots = state.DestinationSlots;
    ...
}

Kind regards,
Valeri Hristov
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
hardik
Top achievements
Rank 1
answered on 03 Jun 2011, 08:40 AM
Hi telerik,

I have tried as per your suggestion. But I am not able to cast DestinationSlots as per my requirement.

See Attached Image. How can I get the resource from this?

Thanks
Hardik
0
Valeri Hristov
Telerik team
answered on 07 Jun 2011, 02:49 PM
Hello hardik,

The value of the DestinationSlots property is a collection, hence the exception. You could use this code:
using System.Linq;
...
IList<Slot> slots = state.DestinationSlots;
IList<IResource> resources = slots.First().Resources.OfType<IResource>();
...

All the best,
Valeri Hristov
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
hardik
Top achievements
Rank 1
answered on 09 Jun 2011, 06:19 AM
Thanks for reply.

As i have try to do as per your suggestion. It gives error of type cast. Actually DestinationSlots are of IEnumerable type not of Ilist.

I have done with IEnumerable and its working fine.

Thanks
Hardik
0
palak
Top achievements
Rank 1
answered on 11 Jul 2011, 09:16 AM
Hi hardik,

I want to implement same kind of logic for same timeslots. i want to restrict appointments which are supposed to be dropped on timeslot where there are already appointments exist, can u pls elaborate how can i do that ? actually i am not able to find any such "CanDrop" method for scheduleview. I am using Q2 beta 2011.

thanks & regards

0
Pana
Telerik team
answered on 15 Jul 2011, 08:09 AM
Hi,

Please check the FirstLook of the RadScheduleView and more precisely the ConflictCheckingDragDropBehavior and how it is applied. In the example one can not drop appointments on taken slots.

Regards,
Pana
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
palak
Top achievements
Rank 1
answered on 15 Jul 2011, 02:01 PM
Hi Pana,

Many thanks for pointing me out this link, how i missed it out just don't know.

It works like a charm.

regards,
palak
Tags
ScheduleView
Asked by
hardik
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
hardik
Top achievements
Rank 1
Valeri Hristov
Telerik team
palak
Top achievements
Rank 1
Pana
Telerik team
Share this question
or