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

No ParentGrid in e.Options.Source

5 Answers 85 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 07 Apr 2009, 03:06 AM
Hi,

I am implementing an application where we have two RadGridViews, and we want to be able to drag and drop items between them

It has been slightly difficult because their ItemsSource are bound to ObservableCollections with different data objects. I only want to transfer the common details across between these two collections, and the left over details ignored

Both RadGridViews are droppable
All rows (with exception of GridViewHeaderRow) are draggable & droppable

Whenever I drag a GridViewRow on to the parent RadGridView, it causes an error

So I would like to implement an if statement that checks if the dragged GridViewRow's parent is not equal to the destinations GridViewRow

However when I drill down the e.Options.Source.Parent = {Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel} and not a RadGridView

Going to the API, there is a Member under GridViewRow called "ParentGrid". However this doesn't appear when I go to e.Options.Source

Can you please offer a suggestion on how to obtain the parent grid of the GridViewRow I am dragging?



5 Answers, 1 is accepted

Sort by
0
Miroslav
Telerik team
answered on 14 Apr 2009, 10:44 AM
Hello Andrew,

I am sorry for the delayed reply,

Please download the latest SP release, this issues has been resolved there and the ParentGrid property should return the GridView.

Best wishes,
Miroslav
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Andrew
Top achievements
Rank 1
answered on 17 Apr 2009, 04:26 AM
I am using the latest version (413) and I am still having the same problem. When dragging from a RadGridView into another RadGridView. At the "OnDropInfo" event:

e.Options.Source = {Telerik.Windows.Controls.GridView.GridViewRow}
e.Options.Source.Parent = {Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel}

Expanding through these, I still can't find the ParentGrid

Suggestions?


0
Miroslav
Telerik team
answered on 21 Apr 2009, 06:58 AM
Hi Andrew,

The ParentGrid property is a property of the GridViewRow class, so you need to cast to it before using it:

var sourceItem = e.Options.Source as GridViewRow;  
var parentControl = sourceItem.ParentGrid; 

The Parent property is a FrameworkElement property and is will point to the logical parent of the row, which is the panel.

Hopefully this will work for you,

Kind regards,
Miroslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Nik
Top achievements
Rank 1
answered on 28 May 2009, 09:15 PM
Hi,

I am not able to figure out.
Can please provide me any code sample for the one RadGridView to other RadGridView drag and drop?
if you can provide sample is VB, its would be great.

Prompt reply really appreciated.

Nik
0
Miroslav
Telerik team
answered on 03 Jun 2009, 12:44 PM
Hello Nik,

Sorry for the delayed reply!

The BugTracker example shows how to drag/drop to and from a grid view:

http://blogs.telerik.com/miroslavpaskov/posts/09-05-15/silverlight_dragdrop_hello_real_world_application.aspx

There the parent GridView is not referenced, but this can happen like so:

Let's say that your drop destination item is the GridViewRow:

'This is how you can get the parent GridView of the   
'destination item:   
Dim gridViewRow = TryCast(e.Options.Destination, GridViewRow)   
Dim parentGridView = gridRow.ParentGrid  

Hopefully this will work for you,

Kind regards,
Miroslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
DragAndDrop
Asked by
Andrew
Top achievements
Rank 1
Answers by
Miroslav
Telerik team
Andrew
Top achievements
Rank 1
Nik
Top achievements
Rank 1
Share this question
or