How drag and drop works

20 posts, 0 answers
  1. hardik
    hardik avatar
    57 posts
    Member since:
    Feb 2011

    Posted 31 Mar 2011 Link to this post

    Hi telerik,

    Can you please provide information how drag and drop will work for scheudlerView? I see your online demo and tried to understand the logic from code.But I am not able to understand.

    EffectivePixelLength, EffectiveOrientation, BehaviorProperty, AppointmentTemplateProperty  are used for which purpose?

    "BehaviorBase"  class is used for what ?

    In scheduler AppointmentEditing event I have done following code and I can cancel the edit Popup.

    How can I do it for scheudlerView?

    I am not able to get  AppointmentEditAction  for schedulerView.

    if (e.AppointmentEditAction == AppointmentEditAction.Resize)
          {
            e.Cancel = true;
          }

     if (e.AppointmentEditAction != AppointmentEditAction.Drag && e.AppointmentEditAction != AppointmentEditAction.Resize)
          {
            e.Cancel = true;
    }

    If you provide any example for drag and drop than its good for me.

    Thanks
    Hardik Pancholi
  2. George
    Admin
    George avatar
    1332 posts

    Posted 05 Apr 2011 Link to this post

    Hi,


    In order to implement a custom drag and drop behavior, I would suggest you to inherit the DefaultDragDropBehavior and set it RadScheduleView.DragDropBehavior. Please, refer to:


     Greetings,
    George
    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
  3. Forest
    Forest avatar
    72 posts
    Member since:
    Aug 2010

    Posted 16 May 2011 Link to this post

    Hi

    I need to use AppointmentEditAction too.
    For example :

    If (e.AppointmentEditAction != AppointmentEditAction.Resize)

    doesn't work with scheduleView.

    Is there any way to use AppointmentEditAction with scheduleView ?
  4. hardik
    hardik avatar
    57 posts
    Member since:
    Feb 2011

    Posted 18 May 2011 Link to this post

    Hi Forest,

    In scheudlerView there isn't anything like AppoitnementEditAction. You have to use CustomDragAndDrop class for re-size and drag & drop.

    Thanks
    Hardik
    SE
  5. kjellerik
    kjellerik avatar
    14 posts
    Member since:
    Jul 2007

    Posted 15 Jul 2011 Link to this post

    hi, after updating to latest version of telerik, i could no longer reference DefaultDragDropBehavior ? Has this been changed?

    Regards
    Kjell Erik 
  6. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 15 Jul 2011 Link to this post

    The DefaultDragDropBehavior class is now obsolete. You should use ScheduleViewDragDropBehavior instead (it the same).

    Best wishes,
    Valeri Hristov
    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!

  7. Michael Lilly
    Michael Lilly avatar
    53 posts
    Member since:
    Apr 2010

    Posted 26 Jul 2011 Link to this post

    I'm not on the Q2 release of your tools yet, so I'm stuck using the DefaultDragDropBehavior.  Unfortunately, I'm running into a problem that I hope I can solve with this version.

    I'm basically using your demo code from the first look example, except changing it to DefaultDragDropBehavior instead of ScheduleViewDragDropBehavior.

    The problem I'm seeing is that when I examine the slots I'm dragging over in this class, they aren't marked as IsReadOnly.  They also are just Slots and not my CustomSlot class.

    Is this due to using the Default instead of ScheduleView behavior?  Is this something I can fix with the Default version, or do I need to hold off until I'm able to use the ScheduleViewDragDropBehavior class?  I'm guessing it is working correctly in ScheduleViewDragDropBehavior.

    Thanks!
  8. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 27 Jul 2011 Link to this post

    Hello Michael,

    The DestinationSlots collection contains new Slot instances that represent the slots where the dragged appointments will be dropped if the user releases the mouse button. Probably if you describe what you are trying to achieve I should be able to provide more adequate advice?

    Greetings,
    Valeri Hristov
    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!

  9. Michael Lilly
    Michael Lilly avatar
    53 posts
    Member since:
    Apr 2010

    Posted 27 Jul 2011 Link to this post

    Correct, I'm looking at the slots in the DestinationSlots collection and even though the slot is marked as IsReadOnly for the SpecialSlots collection, it isn't marked IsReadOnly in the DestinationSlots collection.

    When I turn off the custom DragDrop behavior, it works like it's supposed to.  I drag an appointment over a readonly slot and it won't let me drop it, but when I use the custom behavior (code directly from your demo site) it allows me to drop over a readonly slot.  So I looked at the slots in the DestinationSlots collection and none of them are readonly even when they should be.

    I'm not trying to do anything really special, just use a custom dragdrop like you have in your First Look in combination with the ReadOnly special slots demo.  I haven't even customized it to my needs yet.
  10. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 28 Jul 2011 Link to this post

    Hi Michael,

    I understand now. The read-only checking is not publicly available yet. Since the base implementation of the CanDrop method only checks whether any of the DestinationSlots are overlapping with a read-only Slot and returns false in this case, you could call it in your CanDrop method:

    public override bool CanDrop(DragDropState state)
    {
        return base.CanDrop(state) || /*your custom logic here*/;
    }

    Best wishes,
    Valeri Hristov
    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!

  11. Michael Lilly
    Michael Lilly avatar
    53 posts
    Member since:
    Apr 2010

    Posted 28 Jul 2011 Link to this post

    Great, thanks, that fixed one problem.  The other problem is if it's a custom slot object, the objects that come in are only Slots.  So I can't have custom logic according to the custom slot object properties.

    I was hoping I was just doing something wrong and your first answer would answer this one...that isn't the case.

    Is this also something that isn't supported now?
  12. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 28 Jul 2011 Link to this post

    The Slot objects in the state.DestinationSlots collection are different than the objects in the RadScheduleView.SpecialSlots collection. In other words, the destination slots are the "coordinates" where the appointments are going to be droppped and the special slots are just places in the schedule. The read-only-ness is still internal to RadScheduleView and cannot be customized yet (but will be some day).

    The slots in the two collections are not supposed to be the same, e.g. you should not expect the DestinationSlots collection to contain any of the objects in the SpecialSlots collection.
    Greetings,
    Valeri Hristov
    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!

  13. Michael Lilly
    Michael Lilly avatar
    53 posts
    Member since:
    Apr 2010

    Posted 28 Jul 2011 Link to this post

    So you are saying that it's impossible to have custom drag drop logic for a Special Slot?

    If that's the case, then I'll have to wait for the user to drop it and handle the logic elsewhere.
  14. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 28 Jul 2011 Link to this post

    This is correct. We designed the special slots to be just colored areas in the schedule and later we added the IsReadOnly property. We still don't have many specific use cases for this feature and that's why the API is not very polished yet...

    Greetings,
    Valeri Hristov
    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!

  15. Michael Lilly
    Michael Lilly avatar
    53 posts
    Member since:
    Apr 2010

    Posted 28 Jul 2011 Link to this post

    That's disappointing.  I was able to implement a lot of things around the Scheduler "special slots" functionality (even if it was more of a rig job).

    Our use case is the ability to "Reserve" timeslots for certain types of appointments.  Only an appointment with certain properties can be placed over a reservation.  So when the user does a drag and drop and can't drop on that reservation, I want it to act like a Read Only slot does.  A use case that is probably more universal is that only certain appointment categories can be placed in "Non-working hours".

    Although the new ScheduleView implementation of SpecialSlots is much much better than what I had to do in Scheduler, it is missing some very important things.  This is one of them.  Another is the ability to have a tool tip for SpecialSlots (another unanswered thread on the board).  I also will need to handle a right-click context menu that will change whether it's on SpecialSlots or not, but I haven't gotten to that to see if there is an issue there (I'm betting there is).
  16. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 29 Jul 2011 Link to this post

    Hi Michael,

    Thank you for the feedback. Your use case is very good and we will definitely have it in mind when extending the "special slots" functionality of RadScheduleView.

    Best wishes,
    Valeri Hristov
    the Telerik team

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

  17. Michael Lilly
    Michael Lilly avatar
    53 posts
    Member since:
    Apr 2010

    Posted 10 Aug 2011 Link to this post

    Just as an update, I was able to get my requested functionality working.

    Basically, in the ConflictCheckingDragDropBehavior class, I can access the special slots using this code to get the ScheduleView:

    RadScheduleView scheduleViewControl = (RadScheduleView)state.ServiceProvider.GetService<IDialogProvider>();

    I can then use the special slots collection to find if the dragged appointment goes over a special slot.  Followed by my custom handling of whether the appointment can be dropped or not.

    It still would be cleaner to know if the slot is a special slot or read only slot without having to use the service provider, but for now, this will work for me.  Hopefully others can use this also.
  18. Kotte
    Kotte avatar
    48 posts
    Member since:
    Feb 2011

    Posted 08 Sep 2011 Link to this post

    Hi Valeri Hristov,

    RadScheduleView  DragDrop inside RadPanelBar is not working.
    It is firing CanStartDrag and CanDrop event never fires.
    Here is the code.

    <telerik:RadPanelBar  x:Name="radPanelBar1"  IsTextSearchEnabled="False" VerticalAlignment="Stretch" Margin="0" d:LayoutOverrides="VerticalAlignment" HorizontalAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled">
                        <telerik:RadPanelBarItem x:Name="Calendar" 
     HorizontalAlignment="Stretch">
                            <telerik:RadPanelBarItem.Header>
                                <StackPanel Orientation="Horizontal">
                                  
                                </StackPanel>
                            </telerik:RadPanelBarItem.Header>
                            <Grid Background="White">
                                <scheduleView:RadScheduleView x:Name="scheduler" ActiveViewDefinitionIndex="2"                                                    telerik:StyleManager.Theme="Windows7"  FontSize="9" FontFamily="Arial"  >
                                    <scheduleView:RadScheduleView.ViewDefinitions>
                                        <scheduleView:DayViewDefinition ShowAllDayArea="True"  ShowWeekGroupHeaders="True" />
                                        <scheduleView:WeekViewDefinition ShowAllDayArea="True"  ShowWeekGroupHeaders="True"/>
                                        <scheduleView:MonthViewDefinition VisibleDays="30"  />
                                    </scheduleView:RadScheduleView.ViewDefinitions>
                                    <telerik:RadScheduleView.DragDropBehavior>
                                        <Calendar:CustomDragDropBehavior></Calendar:CustomDragDropBehavior>
                                    </telerik:RadScheduleView.DragDropBehavior>
                                </scheduleView:RadScheduleView>
                            </Grid>
            </telerik:RadPanelBarItem>
    </telerik:RadPanelBar> 


     public class CustomDragDropBehavior : ScheduleViewDragDropBehavior 
        {
            public override bool CanDrop(DragDropState state)
            {
                return true;
            }
            public override bool CanStartDrag(DragDropState state)
            {           
                return true;
            }

            public override void Drop(DragDropState state)
            {
                base.Drop(state);
            }

    }
  19. Rosi
    Admin
    Rosi avatar
    2529 posts

    Posted 13 Sep 2011 Link to this post

    Hi Kotte,

    We are aware of this problem and we will do our best to solve the issue for the future versions of the controls. Meanwhile I suggest you set the ExecutionMode of the RadDragAndDropManager to DragExecutionMode.Disabled in order to workaround the problem.

    Example:
    Copy Code
    RadDragAndDropManager.ExecutionMode = DragExecutionMode.Disabled;
    InitializeComponent();

    !Note that the code is executed before InitializeComponent().

    Kind regards,
    Rosi
    the Telerik team

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

  20. Kotte
    Kotte avatar
    48 posts
    Member since:
    Feb 2011

    Posted 13 Sep 2011 Link to this post

    Hi Rosi,

    Thank you for your response.
    Its working fine now.


    Thanks,
    Kotte.
Back to Top