RadGridView Drag Drop - Drop string into Cell

2 posts, 0 answers
  1. Ed James
    Ed James avatar
    9 posts
    Member since:
    Sep 2008

    Posted 15 Feb 2015 Link to this post

    I've implemented Drag & Drop into a RadGridView. The DataObject I'm dropping is a string.

    I need to detect whether the string is dropped into a Cell (in which case it will add the string to the cell value) or elsewhere on the RadGridView (where a new row will be created).

    private void OnDropAttributes(object sender, Telerik.Windows.DragDrop.DragEventArgs args)
                DataObject data = (args.Data as DataObject);

  2. Nick
    Nick avatar
    593 posts

    Posted 17 Feb 2015 Link to this post

    Hello Ed, 

    You can get the target cell by using the args.OriginalSource property:
    var cell = args.OriginalSource as GridViewCell ?? (args.OriginalSource as FrameworkElement).ParentOfType<GridViewCell>();

    Note however that updating the value in the cell visual element is not recommended as it can have unexpected results when scrolling due to the Row Virtualization. Consider updating the bound property in the business object instead. 


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top