Increasing scrollable area of Diagram.Panel


Excuse me that my english is not well.

I want to increase scrollable area of diagram when I move a node which is dragged from outside of the diagram to edge of it.

I could increase it and scroll diagram automatically when I drag node which is inside of it.
I can’t use MakeVisible or UpdateDiagramBounds method because it is no shape when I drag node from outside of diagram.
I also change the position of Diagram.Panel, but it can’ t increase area of diagram.

I noticed that Diagram.Panel.DiagramBounds property or Diagram.Panel.Position property has relationship to scroll, but I couldn’t force to change them.

Please tell me how to change the scrollable area in diagram(.Panel).


The DiagramPanel.DiagramBounds define exactly the area that the user can scroll to. It is normally automatically computed by calls to DiagramPanel.ComputeDiagramBounds, which returns the union of the bounds of all of the Parts.
The way to “force” the DiagramBounds to be bigger is to either set DiagramPanel.Padding or to set DiagramPanel.FixedBounds. The latter might be more convenient for this situation.

I haven’t tried this, but you could try replacing the standard DiagramPanel within the Diagram’s ControlTemplate with one that overrides the DiagramPanel.ComputeAutoScrollPosition method. Call the base method first to get what it would normally suggest as the new DiagramPanel.Position. Set the DiagramPanel.FixedBounds to be an inflated value of the DiagramPanel.DiagramBounds. Then return the suggested position value.

In a Diagram.ExternalObjectsDropped event handler you then want to set DiagramPanel.FixedBounds back to its default value of new Rect(Double.NaN, Double.NaN, Double.NaN, Double.NaN). This way the diagram’s bounds are computed normally again.

I hope this does what you want.

Hi, walter.

Thank you very much of your replying to my post message, and your explanation helps me to image the mechanism.

I made a custom DiagramPanel class, overrode its ComputeDiagramBounds method and applied to my Diagram’ Control Template.

But I noticed that the overridden method worked when I dragged nodes in diagram, and it didn’t work when I dragged from outside of it.

Next, I also tried to change DiagramPanel.FixedBounds property directly.
It didn’t reflect to UI though I can make sure of changing value of the property.

Reconsidering that, I need a method or mechanism that reflects FixedBounds’ value to DiagramBounds’ value even if a little time.

I can’t find the method, please help me if you have a idea.


I didn’t explain that I stopped the default working while dragging node from outside.
So there are no shape or ghost object when I drag nodes.

Yes, this is a bit complex to explain. I’ll try to come up with a demonstration for how to do it.
Or maybe we should just support autoscrolling with external drags. The latter would be even easier for you.

Are you using GoWPF version 2.0?

I’m sorry to late for replying to you.

No, I’m using GoWPF ver 1.3.
But I receive your mail, I will try to use it that is noted in the mail.

Thank you very much.