This quick start guides you through the steps of adding the DragDropManager in an application to manage user interactions.
To set up and add controls to your application, complete the following steps:
This markup creates a grid with TextBlock and Rectangle controls in separate regions.
In the last step you had set up the application, now to add the drag-and-drop functionality, complete the following steps to add the DragDropManager.
The code initiates a new instance of C1DragDropManager. It then calls the RegisterDropTarget method to indicate that the grid should act as a drop target by default. Further, it calls the RegisterDragSource method to indicate that users should be allowed to drag the elements in the grid. Finally, the code attaches an event handler to the DragDrop event so that the application can receive a notification and move the element being dragged into its new position.
The event handler starts by converting the mouse coordinates into row/column values. Then, it uses the SetValue method to update the Grid.RowProperty and Grid.ColumnProperty values on the element that was dragged.
Now that you've created an application and added code to add drag-drop functionality to the application, the only thing left to do is run your application. To observe your application's run-time interactions, complete the following steps:
What You've Accomplished
Congratulations, you've completed the DragDropManager quick start! You've created a simple application that uses DragDropManager to move items in a grid.