Northwoods.GoXam Namespace : LinkPanel Class |
The simplest Link is implemented with a DataTemplate
that consists of a Shape
that is the stroke (a line) connecting one node with another. In WPF that is normally an instance of LinkShape
; in Silverlight that is normally an instance of System.Windows.Shapes.Path
. Such a link cannot have any arrowheads or text labels or other decorations. Furthermore you cannot connect any link to or from the link itself, nor can any link labels be selectable or manipulable as separate objects.
However, most LinkTemplates are implemented as DataTemplate
s consisting of LinkPanels. The principal child element of a LinkPanel
is normally a LinkShape
(WPF) or Path
(Silverlight) that has the x:Name
of "Path" and that has the attached property IsLinkShapeProperty set to true. The panel arranges the other child elements along the Link's Route according to various attached properties.
To make it easy to implement common arrowheads, you can set the ToArrowProperty and/or FromArrowProperty attached properties on a Path
element.
At the current time a LinkPanel
or LinkShape
/Path
must be the root visual element of a Link.
Here is a simple DataTemplate
for a Link that has an arrowhead: <DataTemplate x:Key="ExampleLinkTemplate"> <go:LinkPanel go:Link.SelectionElementName="Path" go:Link.SelectionAdorned="True" > <go:LinkShape x:Name="Path" Stroke="Black" StrokeThickness="1" /> <Path Fill="Black" go:LinkPanel.ToArrow="Standard" /> </go:LinkPanel> </DataTemplate>
A LinkPanel
may have multiple children (LinkShape
(WPF) or Path
(Silverlight)) for which go:LinkPanel.IsLinkShape="True"
. One of them must be the primary link path, with the x:Name
of "Path"; this is what will be returned by the Path property. All of rest will get the same route geometry as the primary Path. This makes it easy to implement gradient-like effects by using multiple link shapes of different colors: <go:LinkPanel . . .> <go:LinkShape StrokeThickness="7" Stroke="DarkBlue" /> <go:LinkShape StrokeThickness="5" Stroke="Blue" /> <go:LinkShape StrokeThickness="3" Stroke="LightBlue" /> <go:LinkShape x:Name="Path" StrokeThickness="1" Stroke="White" /> . . . </go:LinkPanel>
By default each LinkPanel sets UseLayoutRounding
to false, except that it is set to true when used inside an Adornment.
System.Object
System.Windows.Threading.DispatcherObject
System.Windows.DependencyObject
System.Windows.Media.Visual
System.Windows.UIElement
System.Windows.FrameworkElement
System.Windows.Controls.Panel
Northwoods.GoXam.LinkPanel