Category / Section
How to bring the specific object to the center or viewport of the Diagram in WinRT?
1 min read
The BringIntoCenter and BringIntoViewport methods will assist you to bring the diagramming elements to the center or viewport of the diagram. The methods are exposed in the Info property of diagram and diagramming elements.
This can be achieved by specifying the bounds of Node or Connector in the respective methods. The following code example demonstrates the same.
C#
//BringIntoCenter (diagram.Info as IGraphInfo).BringIntoCenter((node.Info as INodeInfo).Bounds); (node.Info as INodeInfo).BringIntoCenter(); (connector.Info as IConnectorInfo).BringIntoCenter(); //BringIntoViewport (diagram.Info as IGraphInfo).BringIntoViewport((node.Info as INodeInfo).Bounds); (node.Info as INodeInfo).BringIntoViewport(); (connector.Info as IConnectorInfo).BringIntoViewport(); Here, the diagram is the instance of SfDiagram. Here, the node is the instance of Node. Here, the connector is the instance of Connector.