We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Not able to position the nodes when using ItemsSource to bind the nodes

Thread ID:





101785 Nov 21,2011 03:33 PM UTC Nov 24,2011 03:36 AM UTC WPF 1
Tags: Diagram
Satish kumar
Asked On November 21, 2011 03:33 PM UTC

When i bind an observablecollection of nodes to DiagramModel though i specify the X and Y positon of the nodes, they always appear at (0,0) position.

public partial class EditorDiagramView : ViewBase
public EditorDiagramView()
//this.DataContext = new EditorDiagramViewModel();

private void AddNodes()
Node _diagramNode = null;
for (int i = 0; i < 3; i++)
_diagramNode = new Node();
_diagramNode.Content = "Node1";
_diagramNode.OffsetX = 1 + i * 100;
_diagramNode.OffsetY = 1 + i * 100;

private Node _diagramNode;
private ObservableCollection _diagramNodes = new ObservableCollection();

public ObservableCollection DiagramNodes
get { return _diagramNodes; }
Can you please let me know what is wrong here.
When instead of binding to ItemsSource if I add the Nodes individually the position of the Nodes take effect.

Please suggest a solution to this.

Ramya Thirugnanam [Syncfusion]
Replied On November 24, 2011 03:36 AM UTC

Hi Satish,
With regards to Not able to position the nodes when using ItemSource on DiagramModel, we have created a sample to address your query. Please refer to the attachment .


After analyzing your code snippet, we can see that you are using ItemSource to DiagramModel as observablecollection of Node. This creates the reported problem.
Steps to achieve:
1. ItemSource to DiagramModel must contain a collection of Node’s content (UIElement, Business Object), but not collection of Node.
2. OffsetX and OffsetY are dependency property that can be bounded to Offset property of Node’s Content.
3. The DataTemplate of the Node content can be specified using ContentTemplate property of the Node.
We have achieved your requirement using the above steps.

Please let us know if you have any concerns.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon