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

Drag and Drop between TreeView and RadGrid

1 Answer 218 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ivan
Top achievements
Rank 1
Ivan asked on 06 Oct 2017, 09:12 AM

Hello ! I know there are a lot of topics about this but i do have a issue with drag and rop . 
I have a RadTreeView with sting data . The effect i`m looking for is to drag certain string from the TreeView into a Cell of the RadGrid . Each cell to be able to be with different content . 

The tree view is just simple Tree view with data .

I want to able only to drag and drop from TreeView to Grid not the other way around 

Thanks in advance  !

 

 

 

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 11 Oct 2017, 08:43 AM
Hello Ivan,

To achieve your requirement you can use the built-in drag/drop feature of RadGridView and DragDropManager to handle the drop in the RadGridView cells. Here are some steps which you can try.
  1. Enable the drag/drop in RadTreeView. You can do that by setting its IsDragDropEnabled property to True.
  2. Subscribe to the DragDropManager.Drop event and based on the corresponding data edit the cell content.
  3. You have two options for the Drop event. You can subscribe it directly to RadGridView and used ParentOfType<T>() method on the argument OriginalSource to get the GridViewCell element and updated it or its DataContext. The second option is to use the CellLoaded event of RadGridView and subscribe the Drop event to each cell separately.

Additionally you can check the DragDropTreeViewToControls and DragDropWithLines SDK example.

I hope this helps.

Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
Ivan
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or