Re-center a model within Diagram

Hi,

I’m using Syncfusion for 17.4.0.39 for WPF .

I have a sfDiagram which the user scroll and zoom.

I want to:

1. Reset the diagram view to the initial, default zoom and Pan (i.e. return to the initial view no zoom, no pan view)

2. In addition, “focus” the diagram to show a specific node in the center ow the window

a. i.e. if the view is set to show 0,0 as the top left, siagram height is 400 pixels and the node to center is at 500, pan the diagram 300 pixels up (100 + half of 400)


What API I need to apply?

Please note I am forced to use code behind for all actions



Thanks




1 Reply

DT Deepa Thiruppathy Syncfusion Team April 13, 2022 06:33 AM UTC

Hi Dotan,


Please find below response table for all your queries,


Query

Response

1. Reset the diagram view to the initial, default zoom and Pan (i.e. return to the initial view no zoom, no pan view)

It can be achieved by executing Reset command for diagram page.

 

Please find below Ug documentation link for more details about Reset command,

https://help.syncfusion.com/wpf/diagram/commands/zoom#reset

 

2. In addition, “focus” the diagram to show a specific node in the center of the window

a. i.e. if the view is set to show 0,0 as the top left, SfDiagram height is 400 pixels and the node to center is at 500, pan the diagram 300 pixels up (100 + half of 400)

 

We have methods to bring the diagram element to the Viewport if the element is outside of the viewport and bring the diagram element to the center of the viewport if the element is anywhere in the viewport.

 

Please find below KB documentation to know more about those methods,

https://www.syncfusion.com/kb/11523/how-to-bring-the-specific-node-to-the-center-or-viewport-in-wpf-diagram-sfdiagram

 

 


Regards,

Deepa Thiruppathy


Loader.
Up arrow icon