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

GridView to PropertyGrid Drag Drop service

1 Answer 100 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Darren
Top achievements
Rank 1
Darren asked on 24 May 2016, 12:56 PM

using the Drag Drop Service i cant get the e.HitTarget to return true no matter what propertygrid reference i use must be missing something here.

basically i just want to recreate the propertygrid items when a GridDataRowElement is dragged onto a propertygrid.

 

private void svc_PreviewDragOver(object sender, RadDragOverEventArgs e)
{

if (e.DragInstance is GridDataRowElement)
{
e.CanDrop = e.HitTarget is PropertyGridElement;
}
}

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 24 May 2016, 01:44 PM
Hello Darren,

Thank you for writing. 

If your RadPropertyGrid is populated with items, note that the HitTaret is supposed to be the visual item element. You can find below a sample code snippet demonstrating how to allow dragging over the items in RadPropertyGrid:
RadDragDropService svc = this.radGridView1.GridViewElement.GetService<RadDragDropService>();
svc.PreviewDragOver += DragDropService_PreviewDragOver;
this.radPropertyGrid1.ItemFormatting += radPropertyGrid1_ItemFormatting;

private void radPropertyGrid1_ItemFormatting(object sender, PropertyGridItemFormattingEventArgs e)
{
    e.VisualElement.AllowDrop = true;
}
 
private void DragDropService_PreviewDragOver(object sender, RadDragOverEventArgs e)
{
    if (e.HitTarget is PropertyGridItemElement)
    {
        e.CanDrop = true;
    }
}

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Tags
PropertyGrid
Asked by
Darren
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or