Drag And Drop For Grid Elements

4 posts, 0 answers
  1. mlhkml
    mlhkml avatar
    6 posts
    Member since:
    Aug 2007

    Posted 26 Oct 2008 Link to this post

    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.
  2. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 28 Oct 2008 Link to this post

    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.
  3. DevCraft banner
  4. mlhkml
    mlhkml avatar
    6 posts
    Member since:
    Aug 2007

    Posted 09 Dec 2008 Link to this post

    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?

     

  5. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 09 Dec 2008 Link to this post

    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.
Back to Top