how to allow dragging to one property of the propertyGrid?

4 posts, 0 answers
  1. tomas
    tomas avatar
    139 posts
    Member since:
    Sep 2012

    Posted 25 Apr 2013 Link to this post

    I cannot find the corresponding style.

    Thank you.

    Tom
  2. Nick
    Admin
    Nick avatar
    593 posts

    Posted 25 Apr 2013 Link to this post

    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.

  3. DevCraft banner
  4. tomas
    tomas avatar
    139 posts
    Member since:
    Sep 2012

    Posted 25 Apr 2013 Link to this post

    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
  5. Nick
    Admin
    Nick avatar
    593 posts

    Posted 26 Apr 2013 Link to this post

    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.

Back to Top