Hello, i’m wondering if what i want to do is possible. i would like to display some complex label at the begining of a link and at the end of a link. This complex label are built dynamically from some data.
The label should look like something like this :
<font face="Courier New, Courier, mono">-----------------------------------
|Multiple line text | an Icon |
-----------------------------------</font>
and should be displayed at the left of the link (considering a North to south oriented link)
This label is displayed at the beginning of the link and at the end of the link like this :
<font face="Courier New, Courier, mono"> -------------
| from node |
--------------
[Begin Label] |
|
|
[End Label ] |
---------------
| To node |
---------------</font>
From what i have understand, i need to set the offset of the linkPanel to determine the position of my begin and end link labels.
Considering the data template below :
<!-- Link between step -->
<DataTemplate x:Key="LinkTemplateBetweenStepAndStep">
<go:LinkPanel go:Part.Reshapable="True" >
<go:Link.Route>
<go:Route Routing="AvoidsNodes" Corner="10" Curve="JumpOver" />
</go:Link.Route>
<!-- Link arrow -->
<Polygon Fill="Black" Points="0 0 8 4 0 8 3 4" go:LinkPanel.Index="-1"
go:LinkPanel.Alignment="1 0.5" go:LinkPanel.Orientation="Along" />
<!-- link stroke -->
<Path go:LinkPanel.IsLinkShape="True"
Stroke="Black"
StrokeThickness="2"
StrokeDashArray="{Binding Path=Data.ReturnLink, Converter={StaticResource theBooleanDottedLineConverter}}" />
<b><!-- Begin link label element --></b>
<b><font color="#00ff00"><go:NodePanel</font></b> Sizing="Auto"
go:LinkPanel.Index="0"
<b><font color="#ff0000">go:LinkPanel.Offset="0 0"</font></b>
go:LinkPanel.Orientation="None">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=Data.From, Converter={StaticResource theNodeNotificationListStringConverter}}"
TextAlignment="Right"
Visibility="{Binding Path=Data.From, Converter={StaticResource theNodeEnableNotificationConverter}}" />
<Rectangle Style="{StaticResource EmailStyle}"
Effect="{Binding Path=Data.From, Converter={StaticResource theNodeNotificationDisableEffectConverter}}"
Cursor="Hand"
MouseLeftButtonDown="Notification_MouseLeftButtonDown">
<ToolTipService.ToolTip>
<ToolTip Content="{Binding Path=Data.From, Converter={StaticResource theNodeNotificationToolTipConverter}}" />
</ToolTipService.ToolTip>
</Rectangle>
</StackPanel>
</go:NodePanel>
<!-- Middle link label element -->
<go:NodePanel Sizing="Auto"
go:LinkPanel.Offset="NaN NaN"
go:LinkPanel.Orientation="None">
<TextBlock Text="{Binding Path=Data.Text, Mode=TwoWay}"
Style="{StaticResource TextBlockStyle}"
go:Part.TextEditable="True"
Visibility="{Binding Path=Link, Converter={StaticResource theLabelVisibilityConverter}}" />
</go:NodePanel>
<b><!-- End link label element --></b>
<b><font color="#00ff00"><go:NodePanel</font></b> Sizing="Auto"
<font color="#ff0000"><b>go:LinkPanel.Offset ="0 0"</b></font>
go:LinkPanel.Index="-1"
go:LinkPanel.Orientation="None">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=Data.To, Converter={StaticResource theNodeNotificationListStringConverter}}"
TextAlignment="Right"
Visibility="{Binding Path=Data.To, Converter={StaticResource theNodeEnableNotificationConverter}}" />
<Rectangle Style="{StaticResource EmailStyle}"
Effect="{Binding Path=Data.To, Converter={StaticResource theNodeNotificationDisableEffectConverter}}"
Cursor="Hand"
MouseLeftButtonDown="Notification_MouseLeftButtonDown">
<ToolTipService.ToolTip>
<ToolTip Content="{Binding Path=Data.To, Converter={StaticResource theNodeNotificationToolTipConverter}}" />
</ToolTipService.ToolTip>
</Rectangle>
</StackPanel>
</go:NodePanel>
</go:LinkPanel>
</DataTemplate>
I would like to dynamically set the offset.X and offset.Y (highlighted in red) depending of the NodePanel (highlighted in green) width and height. But i don’t succeed in binding the linkPanel offset to the nodePanel width and height.
Is it possible to do that ? if so how ?
Maybe its a wrong approach to do that ? if so could you suggest me another way to do that ?