Category / Section
How to bring the specific node to the center or viewport in WPF Diagram (SfDiagram)?
1 min read
WPF Diagram (SfDiagram) provides support to bring a specific Node to the Center or View of the Viewport. BringIntoCenter() and BringIntoViewport() methods in the ScrollInfo property of the ScrollSettings class of SfDiagram brings the Rect into the Center or View. The Node can be positioned to the Center or within View by specifying the bounds of Node in the respective methods.
C#
//Brings the particular Node to the center. this.ScrollSettings.ScrollInfo.BringIntoCenter((node.Info as INodeInfo).Bounds); //Brings the particular Node to the Viewport. this.ScrollSettings.ScrollInfo.BringIntoViewport((node.Info as INodeInfo).Bounds);