failed to customize drag-drop node

i want to customize drag-drop node while making change to wpf TreeviewToDiagram example. i v changed arg.Source properties, especially the width and the height, but the dropped node kept being of 10.

        private void OnDragEnter(object obj)
        {
            var args = obj as ItemDropEventArgs;
            // args.Source have the data which is dragged for drop.
            if (args.Source is DataObject)
            {
                object dataObject = (args.Source as DataObject).GetData(typeof(DragObject<TreeViewItem>));
                TreeViewItem treeViewItem = (dataObject as DragObject<TreeViewItem>).Source;
                //Convert the unknown treeviewitem to diagram known object(NodeViewModel). 
                args.Source = new NodeViewModel() {
                    UnitHeight = 50,
                    UnitWidth = 150,
                    Constraints = NodeConstraints.Default | NodeConstraints.AllowDrop
                };
            }
        }

5 Replies 1 reply marked as answer

KR Karkuvel Rajan Shanmugavel Syncfusion Team April 15, 2021 12:33 PM UTC

Hi James, 
 
Requirement: Need to customize the Drag and Drop node from TreeView 
 
From the provided code we suspect that you have written a common style for Node and mention height in that. So only you couldn’t able to customize the dropped node. Please remove the common style for Node. We have prepared a simple sample for your requirement. Please find the sample link below. 
 
 
Regards, 
Karkuvel Rajan S 


Marked as answer

JA james April 17, 2021 03:11 PM UTC

it helps me a lot, thx


KR Karkuvel Rajan Shanmugavel Syncfusion Team April 19, 2021 06:25 AM UTC

Hi James, 
 
Most welcome. Please let us know if you need any further assistance.   
 
Regards, 
Karkuvel Rajan S 



JA james May 1, 2021 03:27 AM UTC

hello, when I dragged a node from treeview to diagram and overlapped the node to a existing node in the diagram, I want the node to show indicator style but failed.



KR Karkuvel Rajan Shanmugavel Syncfusion Team May 3, 2021 10:17 AM UTC

Hi James, 
 
Requirement: Need to highlight the dropped node when new node is comes over it. 
 
In SfDiagram , we have the support for Nodedropindicatorstyle after drop the node in the diagram. But your requirement needs indicator while dragging node over the diagram from SfTreeView before dropping. So we have used the DragOver, DragLeave and ItemDrop events to achieve your requirement. In the sample we have used DragOver event to find the TargetNode and remove the highlight for the TargetNode in DragLeave and ItemDrop events. Please find the sample below. 
 
 
Regards, 
Karkuvel Rajan S 


Loader.
Up arrow icon