Capturing a dropped RadGridView header's payload

2 posts, 0 answers
  1. Nathan
    Nathan avatar
    4 posts
    Member since:
    Jul 2013

    Posted 03 Mar 2014 Link to this post

    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?

  2. Nathan
    Nathan avatar
    4 posts
    Member since:
    Jul 2013

    Posted 03 Mar 2014 in reply to Nathan Link to this post

    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;
    }

  3. DevCraft banner
Back to Top