Leave Can we leave original item stay on after DrapandDrop?

3 posts, 0 answers
  1. Wenjie
    Wenjie avatar
    35 posts
    Member since:
    Mar 2013

    Posted 02 Jul 2013 Link to this post

    Example : We have one customer  booking one more room.

  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 05 Jul 2013 Link to this post

    Hi Wenjie,

    You just need to customize the ListBox DragDropBehavior and override its DragDropCompleted method with an empty definition. In order to achieve this, you should create a custom class which inherits from Telerik.Windows.DragDrop.Behaviors.ListBoxDragDropBehavior:

    public class CustomListBoxDragDropBehavior : Telerik.Windows.DragDrop.Behaviors.ListBoxDragDropBehavior
    {
        public override void DragDropCompleted(Telerik.Windows.DragDrop.Behaviors.DragDropState state)
        {
            //base.DragDropCompleted(state);
        }
    }

    Removing the call to base.DragDropCompleted is actually the way to avoid deleting the item from the Source collection. 

    Then you just need to set the newly created class to the DragDropBehavior of the ListBox:

    <telerik:RadListBox Grid.Row="1" ..>
     ...
        <telerik:RadListBox.DragDropBehavior>      
            <local:CustomListBoxDragDropBehavior />
        </telerik:RadListBox.DragDropBehavior>
    </telerik:RadListBox>

    I hope this is helpful.

    Regards,
    Yana
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Wenjie
    Wenjie avatar
    35 posts
    Member since:
    Mar 2013

    Posted 12 Jul 2013 Link to this post

    Thanks
Back to Top