Parts move when all are selected and clicked

Hi Walter,

The following are the steps performed:

  1. Diagram is loaded with nodes and the nodes are connected to each other with links.
  2. we have a feature that when all the nodes and links are selected and double clicked on the link, a pop up control is shown with some values.
  3. Now, after the pop up is shown if I click anywhere on the diagram all the selected components move to the location where I clicked.
  4. When I debugged I found the MoveParts method is called from DraggingTool from DoMouseMove() from ToolManager class.

Not sure why the dragginTool is getting selected and moving the parts.

I expect that the nodes should not move on click in the above steps.

Also, when I commented the pop up code it works fine.

Is that happening reliably? Or only when the click also involves mouse movement, thereby being interpreted as a drag?

How is the popup implemented? Does it get focus? Is it dismissed or closed? If so, how? If not, what is supposed to happen?

It can be replicated everytime when all components on the diagram are selected but works fine in the following scenarios

  1. Select All and Double click on node
  2. When double click done on link without selecting all

Popup is in the view which is controlled by a IsOpen property binded to it. Yes the popup gets the focus and to close the pop up we click on empty part of the diagram. During this time the dragging tool is getting activated and moving the selected parts to the place where we click.

How do you implement that click in the Diagram’s background in order to dismiss the popup? Did you remember to set Handled on the EventArgs?

We are following MVVM and most of the properties are binded and do not use any events of the pop up. I am using StaysOpen property and some triggers on IsOpen. The following is the code.

<Popup x:Name="popup" Placement="Relative" StaysOpen="{Binding DataContext.PopUpViewModel.CanPopupStaysOpen, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ParentScreen}}"
                                           HorizontalOffset="{Binding DataContext.PopUpPosition.X, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ParentScreen}}"
                                           VerticalOffset="{Binding DataContext.PopUpPosition.Y, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ParentScreen}}">
                                    <Popup.IsOpen>
                                        <MultiBinding Converter="{StaticResource PopUpVisibilityConverter}" ConverterParameter="bool">
                                            <Binding Path="DataContext.CanShowFloatingDialog" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=local:ParentScreen}"/>
                                            <Binding Path="Id" Mode="OneWay"/>
                                        </MultiBinding>
                                    </Popup.IsOpen>

I’m guessing the problem is that the DraggingTool is being started at the time that the user clicks in the diagram to get rid of the Popup. That’s why I was asking if you set the RoutedEventArgs.Handled property in that event.

Does the problem not happen if the user carefully clicks in the diagram without moving the mouse while the mouse button is down?

What if the user right-clicks in the diagram rather than left-click?