I have a link with a LabelNode and I want my LabelNode at the first plan. How can I to that?
I’m sorry, but I do not understand “at the first plan”?
You can use the same LinkPanel attached properties for controlling where the label is on the link path, on both LinkPanel elements and for Nodes that are labelnodes.
By first plan I mean, the layer on top (see the image below).
The red box is the LabelNode. I would like my link pass under the LabelNode and not over it.
An other thing, I use the MyModel.SetLinkLabelKey, and everything is done programmatically.
Here is the DataTemplate for LabelNode:
<StackPanel Orientation="Vertical">
<Rectangle Fill="Red" Width="25" Height="50"
go:Node.LinkableSelfNode="False" go:Node.LinkableMaximum="1"
Stroke="Transparent"
StrokeThickness="1"
go:Node.PortId="">
<go:Node.LinkableFrom>
<MultiBinding Mode="TwoWay">
<MultiBinding.Converter>
<local:IsExchangerLinkableConverter />
</MultiBinding.Converter>
<Binding Path="Node.Diagram.AddingTool.CanAddItem" />
<Binding Path="Node.Diagram.AddingTool.ItemType" />
</MultiBinding>
</go:Node.LinkableFrom>
<go:Node.LinkableTo>
<MultiBinding Mode="TwoWay">
<MultiBinding.Converter>
<local:IsExchangerLinkableConverter />
</MultiBinding.Converter>
<Binding Path="Node.Diagram.AddingTool.CanAddItem" />
<Binding Path="Node.Diagram.AddingTool.ItemType" />
</MultiBinding>
</go:Node.LinkableTo>
<Rectangle.Cursor>
<MultiBinding Mode="TwoWay">
<MultiBinding.Converter>
<local:ExchangerNodeCursorConverter />
</MultiBinding.Converter>
<Binding Path="Node.Diagram.AddingTool.CanAddItem" />
<Binding Path="Node.Diagram.AddingTool.ItemType" />
</MultiBinding>
</Rectangle.Cursor>
</Rectangle>
</StackPanel>
</go:NodePanel>
</DataTemplate>
Here is the DataTemplate of the Link:
<go:LinkPanel go:Part.SelectionElementName="Path" go:Part.SelectionAdorned="True" Visibility="Visible"
go:Part.SelectionAdornmentTemplate="{StaticResource LinkSelectionAdornmentTemplate}"
go:Part.Reshapable="True">
<!--Route-->
<go:Link.Route>
<go:Route Routing="Orthogonal" Curve="JumpGap"
FromEndSegmentDirection="RotatedNodeOrthogonal"
ToEndSegmentDirection="RotatedNodeOrthogonal"
RelinkableFrom="True" RelinkableTo="True"
LinkReshapeHandleTemplate="{StaticResource LinkReshapableHandleTemplate}" />
</go:Link.Route>
<go:LinkShape Stroke="Transparent" StrokeThickness="5" />
<go:LinkShape x:Name="Path" StrokeThickness="{Binding Path=Data.Highlight, Converter={StaticResource theStrokeThicknessConverter}}">
<go:LinkShape.Stroke>
<MultiBinding Mode="OneWay" UpdateSourceTrigger="PropertyChanged" >
<MultiBinding.Converter>
<local:StreamColorConverter/>
</MultiBinding.Converter>
<Binding Path="Data.Data"/>
<Binding Path="Link.Diagram.Tag" />
</MultiBinding>
</go:LinkShape.Stroke>
</go:LinkShape>
<!--Arrow Head-->
<Path go:LinkPanel.ToArrow="Triangle"
go:LinkPanel.ToArrowScale="1"
Stroke="{Binding ElementName=Path, Path=Stroke}"
Fill="{Binding ElementName=Path, Path=Stroke}">
<Path.Visibility>
<MultiBinding Mode="OneWay">
<MultiBinding.Converter>
<local:StreamArrowHeadVisbilityConverter />
</MultiBinding.Converter>
<Binding Path="Data.Data"/>
<Binding Path="Link.Diagram.Tag" />
</MultiBinding>
</Path.Visibility>
</Path>
<!--Tin-->
<TextBlock go:LinkPanel.Index="0"
go:LinkPanel.Offset="NaN NaN"
go:LinkPanel.Orientation="Upright">
<TextBlock.Text>
<Binding Path="Data.Data.InitialTemperature">
<Binding.Converter>
<converters:MeasureConverter DecimalPrecision="1" DefaultMeasure="{StaticResource DefaultTemperature}" />
</Binding.Converter>
</Binding>
</TextBlock.Text>
</TextBlock>
<!--Tout-->
<TextBlock go:LinkPanel.Index="-1"
go:LinkPanel.Offset="NaN NaN"
go:LinkPanel.Orientation="Upright">
<TextBlock.Text>
<Binding Path="Data.Data.FinalTemperature">
<Binding.Converter>
<converters:MeasureConverter DecimalPrecision="1" DefaultMeasure="{StaticResource DefaultTemperature}" />
</Binding.Converter>
</Binding>
</TextBlock.Text>
</TextBlock>
</go:LinkPanel>
</DataTemplate>
You could set the go:Part.LayerName=“Background” on the link datatemplate, or altenatively “Foreground” on the label node.
Cool, it works.
Thank you again Walter!