Hi Smadar,
Requirement: How to get the elements that are intersected with dropped node
It can be achieved by using ItemDropEvent where we can identify whether the node is dropped over another node. Also, AllowDrop constraint added for all the nodes through ItemAddedEvent to trigger ItemDropEvent for drag and dropping the existing node in the diagram over another node.
Code snippet:
|
//Enable allow drop constraint to nodes that are added into diagram page.
private void MainWindow_ItemAdded(object sender, ItemAddedEventArgs args)
{
if (args.Item is INode)
(args.Item as INode).Constraints |= NodeConstraints.AllowDrop;
}
//Event to get intersecting elements of currently dropped item.
private void MainWindow_ItemDropEvent(object sender, ItemDropEventArgs args)
{
List<object> intersectingElements = args.Target as List<object>;
foreach (var node in intersectingElements)
{
//You can add your own logic.
}
} |
Regards,
Deepa Thiruppathy