This is a migrated thread and some comments may be shown as answers.

how to Drag & drop row from Gridview to GridView??

16 Answers 394 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jin Hyeok Kim
Top achievements
Rank 1
Jin Hyeok Kim asked on 16 May 2009, 01:01 PM

Hi,

I try drag & drop function from gridview1 to gridview2 in wpf application. but i don't know
please help me..

Thanks.

16 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 18 May 2009, 07:41 AM
Hi Jin Hyeok Kim,

One of our customers has already done that. He has posted the code of his drag and drop application here - http://www.telerik.com/community/forums/silverlight/gridview/gridview-draganddrop-selection-problem.aspx
For your convenience I have used Pablo's code to create a solution that you can easily run - you can find it attached to my reply.

Best wishes,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jin Hyeok Kim
Top achievements
Rank 1
answered on 18 May 2009, 12:42 PM
hi
Thanks for your help, but I have a question.
I know that namespace(Telerik.Windows.Controls.DragDrop) does not exist in WPF.
Is this sample execution possible even at WPF?
I execute project in wpf.
0
Milan
Telerik team
answered on 20 May 2009, 05:35 PM
Hi Jin Hyeok Kim,

Excuse me for sending you the SL drag/drop. The RadGragDropManager is not available for WPF so currently there is no straightforward way of moving rows from one grid to the other. Nevertheless I have created one class called GridDragDrop that implements this functionality.

You just have to create an instance of the GridDragDrop class and pass it references to two grids. Whenever the user drags a row from one of the grids and drops it on the other the RowDropped event will ve raised, giving you the freedom to remove the row form the first grid and add it to the second one.

I am sending you a project that demonstrates the GridDragDrop class.
Hope this helps.

Greetings,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
StevenDale
Top achievements
Rank 2
answered on 15 Oct 2009, 02:32 AM
I implemented this solution in my project, however my grid has a and the child heirarchy which no longer opens when this solution is in use.

Thanks,

Billy Jacobs
0
Milan
Telerik team
answered on 20 Oct 2009, 11:28 PM

Hello Billy Jacobs,

I'd love to send you a new sample since the one that I have posted here is a bit outdated and now I will be able to get a better result with fewer lines of code. 

I would really appreciate it if you could share some more information about your scenario so that I do not miss some important detail that might be crucial for your scenario. Some questions that come to my mind are: Is hierarchy used for both source and target grids? What kind of hierarchy is used (Property hierarchy, self-referencing, etc).


Best wishes,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
StevenDale
Top achievements
Rank 2
answered on 21 Oct 2009, 02:28 AM
Both grids have child hierarchies. Both are property heirarchies. The first list contains a list of employees and the second grid contains a list of jobs. When I drag an employee to a job or a job to a employee I will assign the job to the employee. Also, I want to be able to expand the heirarchy with the left mouse button as well as use the left mouse button to drag and drop.

Let me know if you need more detail.

Thanks,

Billy Jacobs
0
Milan
Telerik team
answered on 27 Oct 2009, 02:42 AM
Hello Billy Jacobs,

Excuse me for the delay. The sample will be ready tomorrow.


Kind regards,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Milan
Telerik team
answered on 29 Oct 2009, 02:55 AM
Hi Billy Jacobs,

Here is the sample that I have promised. The sample application contains one class called GridDragDrop which enables the drag and drop between two grids. The sample application demonstrates how this class can be used.

I hope this will be helpful.
Once again I am really sorry for the delay.


All the best,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Kennet
Top achievements
Rank 2
answered on 09 Nov 2009, 01:55 PM
Milan do you have an example for Q3 build.

I using a simple flat collection. I have two grids and need Drag&drop from "Grid #1" to "Grid #2" grid (with insert, so I can drop anywhere on the grid) and drag&drop within the "Grid #2" so I can change position on items. No need to drag&drop from "Grid #2" to "Grid #1" grid.

/Ken

*** SOLVED ***
0
Milan
Telerik team
answered on 12 Nov 2009, 01:53 PM
Hello Kennet,

I will be posting a a blog post on to that topic soon. I will try to do it tomorrow and notify you when the post is public. You will be able to enable the row reorder functionality that with just a few lines of XAML code.


Sincerely yours,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
StevenDale
Top achievements
Rank 2
answered on 12 Nov 2009, 02:11 PM
Hello Milan,

Thanks for the sample code on the drag and drop. It worked perfectly until I upgraded to Q3 and now I get build errors with the dragdrop objects. I can send you the specific errors if you need but it looks like you are aware of this issue. 

Could you update the sample to work for Q3?

Thanks,

Billy Jacobs
0
Milan
Telerik team
answered on 17 Nov 2009, 09:07 PM
Hi Billy Jacobs,

I will post the updated sample tomorrow.


Sincerely yours,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Milan
Telerik team
answered on 19 Nov 2009, 12:24 AM
Hi Billy Jacobs,

Here is the updated version of the project that works with Q3.


Sincerely yours,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
StevenDale
Top achievements
Rank 2
answered on 12 Mar 2010, 06:15 PM
The sample you sent works as is but when I try to use it in my project I get errors when I drag the grid item outside of the grid. 

The error is when it is trying to capture the mouse rectangle within the telerik framework.
 
I have Q3 SP2.
 
I am forced to downgrade to the Q2 sample where it works.
0
StevenDale
Top achievements
Rank 2
answered on 09 Aug 2013, 01:01 PM
Would it be possible for you to upgrade this example to use the new DragDropManager? The examples provided for drag & drop do not allow me to get the target row and therefore I can't get the datacontext for the target row. I can modify the DragDrop demo to use 2 Grids, but I can't get the row that the drop occurred on nor the object databound to the row. I am not just trying to move the item from one GridView to the other. I am trying to associate the item in one grid to the item in the other grid.

Thanks,

Billy Jacobs
0
Yoan
Telerik team
answered on 14 Aug 2013, 08:44 AM
Hi Billy,

Please, refer to these two articles - Enable Row Reordering within two RadGridView-s and Drag and Drop within RadGridView. They provide extensive information on how to accomplish this task. You can check this online demo as well (you can find the same example in your local copy of WPF demos).
 

Regards,
Yoan
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 >>
Tags
GridView
Asked by
Jin Hyeok Kim
Top achievements
Rank 1
Answers by
Milan
Telerik team
Jin Hyeok Kim
Top achievements
Rank 1
StevenDale
Top achievements
Rank 2
Kennet
Top achievements
Rank 2
Yoan
Telerik team
Share this question
or