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

RadGridView Drag Drop - Drop string into Cell

1 Answer 97 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ed James
Top achievements
Rank 2
Ed James asked on 15 Feb 2015, 08:58 AM
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);

            ...?

1 Answer, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 17 Feb 2015, 08:50 AM
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. 

Regards,
Nick
Telerik
 

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.

 
Tags
GridView
Asked by
Ed James
Top achievements
Rank 2
Answers by
Nick
Telerik team
Share this question
or