Mouse multi selection of complex node

I seek a way to select several nodes (by holding left mouse button),but only rectangle inside each node to be selected.
Each node is contained of two clickable entities - circle and rectangle. (I used go:Part.Selectable=“True” of each of them to make them be clickable)

As you see circles are selected, instead of rectangles.
How can accomplish this, and not loosing functionality of selecting circle and rectangle independently?

To be clear, are you showing two Nodes in your screenshot? If you want the selection Adornment to go around the green rectangle, give it an x:Name and then set SelectionElementName Property to that name. You can find lots of examples of this throughout the samples.

Yes, in previous screenshot were two Nodes.
I partially resolved multi Node selection by catching MouseLeftButtonUp event and setting for each node SelectionElementName=rectangle name, like this:

Xaml:
MouseLeftButtonUp=“myDiagram_MouseLeftButtonUp”

Code behing (C#):
private void myDiagram_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
if (myDiagram.SelectedParts != null && myDiagram.SelectedParts.Count > 1)
{
myDiagram.SelectedParts.ToList().ForEach(x => ((MyObject)x.Data).SelectionElementName= “RectangleName”
}
}

I checked in previous example if I have more than one SelectedParts which mean I used multi selection and rectangle should be selected.

But I still have a problem for a single Node, how I can distinguish between mouse adornment event (Image1) and mouse left button single click event on Node (Image2) ?

Image1:

Image2:

I believe that if I will catch proper event (Adornment selection or single click) it will help me to put the right string in SelectionElementName (RectangleName or CircleName).

I’m sorry, but I still do not understand the behavior that you want to implement.

First, I hope it is clear that Diagrams maintain a selection collection, Diagram.SelectedParts that only holds Parts (Nodes and Links), not any FrameworkElement. The collection is a Set, so the same Node cannot be selected twice. Part.IsSelected is a boolean property.

So what are all of the possible states that you want to permit? And in what order might they be achieved? And what did you not want to allow?

Possible states that I currently have, where I can select circle and rectangle independently by clicking on them (and fully satisfied with it):

States that I currently have and states that should be:

Well, one answer would be to override DragSelectingTool.SelectInRect to set the Node.SelectionElementName to the name of the rectangle.

But it’s still unclear to me what you want. Call the adornment about the circle State A and call the adornment about the rectangle as State B. What should happen when an already selected node in State A is inside the user-drawn DragSelectingTool’s Box when SelectInRect is called? (I’m assuming an already selected node is State B should remain unchanged.)

Also, if a node is in State A, if the user clicks on the node’s rectangular area switch the node to be in State B? And vice-versa, from State B to State A? Or should both circular and rectangular adornment exist simultaneously?

And what should happen if a node is selected in some other manner?