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

Capturing a dropped RadGridView header's payload

1 Answer 68 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
Nathan
Top achievements
Rank 1
Nathan asked on 03 Mar 2014, 10:58 PM
I have an existing RadGridView, and would like to allow users to drop the header columns onto another control of mine.  All I need to capture is the header text and/or "UniqueID".  I've successfully set up a drop target, but the "DragEventArgs.Data" property seems to be inaccessible.  It has the type "Telerik.Windows.DragDrop.Behaviors.DragPayload.FullTrustPayload" -- I can see that this type contains a member "dataStore" that has the info I need, but the property is not public, so I can't access it.

Is there any way to access information about a dropped GridViewHeaderCell?

1 Answer, 1 is accepted

Sort by
0
Nathan
Top achievements
Rank 1
answered on 03 Mar 2014, 11:21 PM
Ok, figured it out.  The "args.Data" property can be cast to "IDragPayload", which has a property "GetFormats", which in turn reveals the data keys that are available.  One of them is "DraggedCell", which yields the GridViewHeaderCell reference.

So, to answer my original question, all I needed in the handler was this:

        private void OnDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs args)
        {
            var payload = args.Data as Telerik.Windows.DragDrop.Behaviors.IDragPayload;
            var headerCell = ((GridViewHeaderCell)payload.GetData("DraggedCell"));
string uniqueName = headerCell.DataColumn.UniqueName;
}

Tags
DragAndDrop
Asked by
Nathan
Top achievements
Rank 1
Answers by
Nathan
Top achievements
Rank 1
Share this question
or