GridView to Diagram - Drag & Drop

3 posts, 1 answers
  1. Joel Palmer
    Joel Palmer avatar
    164 posts
    Member since:
    May 2009

    Posted 04 May 2015 Link to this post

    Do you have an example that would show me how to drag and drop between a RadGridView and a RadDiagram?


    Thanks for your help,


  2. Answer
    Martin avatar
    1041 posts

    Posted 05 May 2015 Link to this post

    Hello Joel,

    No we do not have such example but drag/drop between RadDiagram and another control could be quite straight forward. You can use the DragDropManager to achieve your requirement. Basically, you can subscribe for its DragInitialize event and in the event handler create new DiagramDropInfo with the shape that will be generated from the grid row's data. Here is an example:
    DragDropManager.AddDragInitializeHandler(this.gridView, OnGridViewDragInit);
    private void OnGridViewDragInit(object sender, DragInitializeEventArgs e)
        var gridViewRow = e.OriginalSource as GridViewRow;
        if (gridViewRow != null)
            e.AllowedEffects = DragDropEffects.Copy;
            MyRowDataObject data = (MyRowDataObject)gridViewRow.DataContext;
            var shape = new RadDiagramShape() { Content = data }; // or whatever shape or configuration you need for the diagram
            var dropInfo = new DiagramDropInfo(new Size(100, 100), SerializationService.Default.SerializeItems(new List<IDiagramItem> { shape }));
            e.Data = dropInfo;
            e.DragVisual = new TextBlock() { Text = data };
    I also attached a sample project demonstrating this approach. Please give it a try and let me know if it helps.


    See What's Next in App Development. Register for TelerikNEXT.

  3. DevCraft R3 2016 release webinar banner
  4. Joel Palmer
    Joel Palmer avatar
    164 posts
    Member since:
    May 2009

    Posted 06 May 2015 in reply to Martin Link to this post

    This looks great.  I'll give it a try.
Back to Top