Detexting if I am on the same slot

3 posts, 0 answers
  1. Christie Admin
    Christie Admin avatar
    239 posts
    Member since:
    Aug 2013

    Posted 10 Apr 2014 Link to this post

    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. Christie Admin
    Christie Admin avatar
    239 posts
    Member since:
    Aug 2013

    Posted 10 Apr 2014 in reply to Christie Admin Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. Kalin
    Admin
    Kalin avatar
    1208 posts

    Posted 14 Apr 2014 Link to this post

    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.

     
Back to Top