Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic External labels for nodes (Read 2047 times)
Sabrina C.
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 35
Joined: Dec 20th, 2012
External labels for nodes
Sep 12th, 2016 at 2:01pm
Print Post  
Hi,

we're trying to find good way to put labels of nodes external with respect to the bounding box of the node (e.g. on the bottom). We need such functionality because often the node itself is a way too small to encapsulate all the text we need to layout. At the same time, we want that any arrows connected to the node bounding box behaves the same without interfering with the text. The text box should be bigger than the bounding box of the node to include more lines of text.

Currently we're struggling with different type of elements in the node template hierarchy, but none of them works as intended.

Do you have any suggestion?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: External labels for nodes
Reply #1 - Sep 13th, 2016 at 9:08am
Print Post  
Hi,

Here's one way to do it -

Code
Select All
<DataTemplate DataType="{x:Type local:MyNode}">
	<Canvas ClipToBounds="False">

		<Ellipse Stroke="Red" Width="{Binding Bounds.Width}" Height="{Binding Bounds.Height}" />
		<TextBlock Canvas.Top="{Binding Bounds.Height}" Text="{Binding Text}" />

	</Canvas>
</DataTemplate> 



It can probably be done with grid or stack panels too, e.g. by binding first row's height to node's height.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Sabrina C.
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 35
Joined: Dec 20th, 2012
Re: External labels for nodes
Reply #2 - Sep 19th, 2016 at 9:02am
Print Post  
Thank for your reply. We're already tried with Canvas, and we're sticking to it since it is the only solution that allows the textblocks to overflow node bounds.

S.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: External labels for nodes
Reply #3 - Sep 19th, 2016 at 11:38am
Print Post  
I've managed to allow overflow with Grid panel too, by means of negative margin -

Code
Select All
<DataTemplate DataType="{x:Type local:MyNode}">
	<Grid ClipToBounds="False" Margin="0,0,0,-100">

		<Grid.RowDefinitions>
			<RowDefinition Height="{Binding Bounds.Height}" />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>

		<Ellipse Stroke="Red" />
		<TextBlock Grid.Row="1" Text="{Binding Text}" />

	</Grid>
</DataTemplate> 



The margin specified like that serves as a MaxHeight for the auto-sized row, kind of. Otherwise Auto takes lower precedence than available height set by the node, and the text row would be measured as zero-height.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint