Drag & Drop DataGridRows

Here is the sample code for drag & drop of the DataGridRows I did couple of months back updated to work in beta 2

We dont get mouse events so we have to use another canvas or something which will sit on top of the datagrid at the same location as the datagird, we set the zIndex to a higher number

   <Canvas Width=”300″ x:Name=”datagrid1Canvas”
 Canvas.ZIndex=”2″
        Margin=”80,85,0,10″
        Height=”250″
        Background=”Transparent”/>

you can download the source here

Advertisements

9 thoughts on “Drag & Drop DataGridRows

  1. I want to be able to move the rows around the same grid. Is it possible to do? If so can you please post the code in SL2.
    Thanks

  2. Thanks Lee, It works beautifully.

    I have 2 questions:

    1. Why is the drag and drop working from top to bottom only. Why is it not working when i try to move the bottom row to top? Can we make that working?

    2. Is there a possiblity to select more than one row and move all the selected rows, instead of moving each row at a time..?

    Thanks Lee, you are doing great job.

  3. 1. In the Page_MouseLeftButtonUp handler we have a check
    if (horizDrag > minimumHorizontalDragDistance || vertDrag > minimumVerticalDragDistance)

    it is because of this, drag& drop wont occur for small distances
    2. it should be possible, but did not try

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s