Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
Drag node from XamDataTree onto XamDiagram

In my application, I have a XamDataTree, and I want to be able to drag a node from the tree and drop it onto a XamDiagram and have a node created for it there.

However, I am having trouble setting the XamDiagram as a drop target. When I do drop the node onto the XamDiagram and the XamDataTree_NodeDragDrop event handler is called, the DragDropEventArgs.DropTarget is not of type XamDiagram, but instead of type Border, where for some reason, the Border looks to be the container border for the XamDiagram's options pane.

My xaml looks like this:

<ig:XamDataTree x:Name="MyDataTree"
                        ItemsSource="{Binding Source={StaticResource DataUtil}, Path=CategoriesAndProducts}"
<ig:XamDiagram x:Name="MyDiagram">
        <ig:DropTarget IsDropTarget="True"
                    DropTargetMarkerBrush="Azure" />

And my XamDataTree_NodeDragDrop looks like this:

private void MyDataTree_NodeDragDrop(object sender, TreeDropEventArgs e)
            XamDataTreeNodeControl draggedNode = e.DragDropEventArgs.DragSource as XamDataTreeNodeControl;
            object data = (draggedNode?.DataContext as XamDataTreeNodeDataContext)?.Data;
            UIElement dropTarget = e.DragDropEventArgs.DropTarget;

            if (dropTarget is XamDiagram) // This evaluates to false
                // Add new node to diagram
            else if (dropTarget is Border) // This evaluates to true
                // Why is the drop target not the XamDiagram??

It almost seems as is the XamDiagram's options pane is also set as a drop target by default and is somehow catching the drop events before they can bubble up to the XamDiagram itself.

Why might this behavior be occurring? Am I defining the drop target on the XamDiagram incorrectly?