In this post I will demonstrate how to extend the Drag Drop functionality of the RadDragAndDropManager adding command support by using the attached behaviors extensibility. That way one can easily move the logic for the operation from the code behind into your model and work only with the Data object. To demonstrate the idea I will use scenario where items are being dragged between ListBoxes.
The behavior transforms the Drag Drop events into commands. It exposes the following properties:
- DragCommand – executed when dragInfo event is raised.
- DropCommand – executed when dropInfo event is raised.
- DragCueTemplate – data template that defines the dragcue appearance.
The command parameter being transferred to the commands contains the data describing the drag status. In order to handle more specific cases we can transmit additional information to the viewmodel by adding additional properties:
If you like this functionality you can check the attached project demonstrating this in action
Download Source SL4
Download Source WPF
Tsvyatko Konov is software developer in Telerik Windows 8 product team. You can follow him on Twitter @tsvyatco and his personal blog at www.konov.me
Copyright © 2017, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.