Diagram Scroll Position

Hi,

I have tried to Set Diagram control’s Zoom and scroll position through programmatically.

I have written the code inside the myDiagram_TemplateApplied(object sender, DiagramEventArgs e) event. But scroll position seems not working.

I am using the following code for setting the Scroll Position.

myDiagram.Panel.Position = new Point (50d, 50d);

When I tried the same code inside a Button Click event. At that time it seems working.

Why this is not working inside TemplateApplied(object sender, DiagramEventArgs e)?

Thanks In Advance.

Regards,

Ranish

The Diagram.TemplateApplied event occurs after the ControlTemplate has been expanded. Normally it’s used to be able to access the Diagram.Panel and some other things that are created and initialized during thiat process.

However the initial nodes and links of the diagram haven’t been created and initialized and laid-out and rendered yet. Normally you could do something at that time by implementing a Diagram.InitialLayoutCompleted event handler.

But if you are just trying to set the DiagramPanel.Position, it’s easiest to just set the Diagram.InitialPosition property. There are other Diagram.Initial… properties that are also used to initialize the DiagramPanel properties.

Thank you for your reply.
I have moved my code to Diagram.InitialLayoutCompleted events.
Now its working

Regards,
Ranish