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

Drag And Drop For Grid Elements

3 Answers 137 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
mlhkml
Top achievements
Rank 1
mlhkml asked on 26 Oct 2008, 10:45 PM
Hi,

I just want to drag and drop a grid's element. In other words, I want to rearrange the elements place by dragging. The drag and drop operations change the elements Grid.Row and Grid.Column propertis. I can just one element drag and drop to another cell of grid.

Can you make a very small and simple demostration.

Regards.

3 Answers, 1 is accepted

Sort by
0
Miroslav
Telerik team
answered on 28 Oct 2008, 04:49 PM

Hi mlhkml,

It is not a problem for the Grid panel to be a destination for the drop operation, but it is a bit tricky to inderstand where the new element should be placed. You cannot easily guess the row/column from the mouse position or at least not in the general case.

Therefore it is a good ida to put something in the cells you want to act as drop targets. I am attaching a small demo.

All the best,

Miroslav
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
mlhkml
Top achievements
Rank 1
answered on 09 Dec 2008, 02:20 PM
I wonder that where the AddHandler and RemoveHandler methods come from.

dragGrid.AddHandler(

RadDragAndDropManager.DragQueryEvent, new EventHandler<DragDropQueryEventArgs>(OnDragQuery));

the default Grid control does not include these methods. What I am supposed to do to use these methods?

 

0
Miroslav
Telerik team
answered on 09 Dec 2008, 02:41 PM
Hi mlhkml,

These are extension methods for all Controls. To use an extension method, you need to have included its namespace. In this case you need to add:

using Telerik.Windows;

The extension methods are translated by the compiler to normal static methods calls, but they "feel" like an addition to the class.

Sincerely yours,
Miroslav
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
DragAndDrop
Asked by
mlhkml
Top achievements
Rank 1
Answers by
Miroslav
Telerik team
mlhkml
Top achievements
Rank 1
Share this question
or