Diagram.IsReadOnly and dragging nodes


I want to have an editable and a read only state of the diagram. As far as I understood the documentation, Setting IsReadOnly should disable dragging and deleting of diagram elements.

But for nodes, I have found out that it is possible to drag them around in the diagram. One curious Thing to note about this is, that while dragging the node is not visible (in contrast to the edit mode where it is visible during dragging).

Don’t know if it is relevant, but I removed the DragSelectionTool to support panning. Btw, is it possible to have the panning tool activated on a key binding (e.g. Ctrl+Left Mouse))

Kind regards,

To clarify, are you saying that when Diagram.isReadOnly is true, the user can drag a Node, causing its Node.Location to change, while not moving any other Nodes?

Yes. With this strange behaviour that the dragged node is not visible while moving it. But is is relocated to the Location where the dragging Ends.

What combination of properties have you set on the Diagram?

Hello Walter,

the diagram is declared as below. Additionally, when initializing the model, I also set

diagram.Model.Modifiable = true;  

I Change the IsReadOnly flag inside a Transaction in an Action listener method.

<go:Diagram Grid.Row="0" 
    			NodeTemplateDictionary="{StaticResource NodeTemplates}"
    			LinkTemplateDictionary="{StaticResource LinkTemplates}"
    			Padding="5"> <!-- workaroung: set a padding because the printed version otherwise would cut off the bottom a bit -->
    		<go:GridPattern CellSize="10 10">
    			<Path Stroke="LightGray" go:GridPattern.Figure="HorizontalDot" />
    		<layout:LayeredDigraphLayout Direction="90" SetsPortSpots="False"/>
    		<designer:STOWorkflowDesignerLinkingTool TemporaryLinkTemplate="{StaticResource TemporaryLinkTemplate}"/>

Hmmm. This is a bit complicated, but the problem appears to be that we sometimes want the DraggingTool to be started even though the Diagram.IsReadOnly, when dragging out from the diagram to drop in some other diagram.

The reason you don’t see anything moving is that during the drag the DraggingTool methods do check for Diagram.IsReadOnly, so one cannot move or copy the selection. But upon a mouse-up event, the move happens anyway.

I suggest that for now you also set or bind DraggingTool.MouseEnabled to false when you want to make the diagram “read-only”.

Works. Thanks!!!