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

how to allow dragging to one property of the propertyGrid?

3 Answers 44 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
tomas
Top achievements
Rank 1
tomas asked on 25 Apr 2013, 11:53 AM
I cannot find the corresponding style.

Thank you.

Tom

3 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 25 Apr 2013, 02:19 PM
Hello Tom,

May I ask you to share what you are trying to achieve? A screenshot would be really helpful!

Looking forward to hearing from you! 

Greetings,
Nikolay Vasilev
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
tomas
Top achievements
Rank 1
answered on 25 Apr 2013, 05:37 PM
My bussines object contains some properties and for example the driver property (another class). My so called drivers all already visualized by the treeview. I would like to drag driver from the treeview to the corresponding property of that business object in the RadPropertyGrid.

Is this clear enough?

Nothing special.

I have the problem how to identify the property, where I have dropped dragged data.

Something like destinationItem for a RadTreeView:
private void OnDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            if (this.isTreeSource)
            {
                var data = DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedData");
 
                this.sourceItems.Remove(data);
            }
 
            if (e.Effects != DragDropEffects.None)
            {
                var destinationItem = (e.OriginalSource as FrameworkElement).ParentOfType<RadTreeViewItem>();
                var dropDetails = DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails") as DropIndicationDetails;
                var data = DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedData");
 
                if (destinationItems != null)
                {
                    int dropIndex = dropDetails.DropIndex >=
                        destinationItems.Count ? destinationItems.Count : dropDetails.DropIndex < 0 ? 0 : dropDetails.DropIndex;
 
                    this.destinationItems.Insert(dropIndex, data);
                }
            }
        }

How can I find the destination property item? My properties are populated manually.

Thank you very much.

Tom
0
Nick
Telerik team
answered on 26 Apr 2013, 10:49 AM
Hello Tomas,

You can get it by assigning a DropHandler to the Property Grid and get the e.OriginalSource.ParentOfType<PropertyGridField>() item. 

Hope this helps! 

All the best,
Nikolay Vasilev
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
DragAndDrop
Asked by
tomas
Top achievements
Rank 1
Answers by
Nick
Telerik team
tomas
Top achievements
Rank 1
Share this question
or