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

Node resize

Thread ID:





102221 Jan 10,2012 09:48 PM UTC Jan 12,2012 05:17 PM UTC WPF 1
Tags: Diagram
Mary Fontana
Asked On January 10, 2012 09:48 PM UTC

I am using the DiagarmModel with DirectedTreeLayout .
I set the same width/height for all nodes in tree.

Is there a way to display the nodes so that the node will resize to fit the node label?



Ramya Thirugnanam [Syncfusion]
Replied On January 12, 2012 05:17 PM UTC

Hi Mary,

With regards to Node resizing on its Label changes, this can be achieved by specifying the Size of Node as double.NaN. Node Size will be changed according to its Label size. Please refer to the code Snippet for this. Please refer to the sample which represent your requirement from attachment.

Sample Details:
In that sample, we have created a DirectedTreeLayout. Please Select the Node and Start Editing the provided Text box, it updates the Label of the Selected Node. The Node resizes on its Label changes.

Code Snippet:
//Register the Label changed event
diagarmView.NodeLabelChanged += new LabelChangedEventHandler(diagarmView_NodeLabelChanged);

void diagarmView_NodeLabelChanged(object sender, LabelRoutedEventArgs evtArgs)
Node curnode = (evtArgs.Node as Node);
//For resolving the Node resizing on content changes
curnode.Width = double.NaN;
curnode.Height = double.NaN;
//solution to overcome the restriction of basic operation like Node resizing, rotating, automatic layouts.
curnode.Width = curnode.ActualWidth;
curnode.Height = curnode.ActualHeight;
If this response does not satisfy your requirement, please get back us with more details of your expectations.

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

or the page will be automatically redirected to 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