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.
Unfortunately, activation email could not send to your email. Please try again.

Node resize

Thread ID:

Created:

Updated:

Platform:

Replies:

102221 Jan 10,2012 04:48 PM Jan 12,2012 12:17 PM WPF 1
loading
Tags: Diagram
Mary Fontana
Asked On January 10, 2012 04:48 PM

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?

Thanks,

Mary


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

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;
curnode.UpdateLayout();
//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.
Regards,
Ramya




NodeResizes_45baafbf.zip

CONFIRMATION

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.

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.

;