Northwoods.GoSilverlight 1.2.2 Assembly
LinkPanel Class
Members  See Also  Send Feedback
Northwoods.GoXam Namespace : LinkPanel Class

A LinkPanel is a Panel used to position and orient elements along the route of a Link.

Syntax

Visual Basic (Declaration) 
Public Class LinkPanel 
   Inherits System.Windows.Controls.Panel
C# 
public class LinkPanel : System.Windows.Controls.Panel 

Remarks

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 Diagram.LinkTemplates are implemented as DataTemplates 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>
            
In Silverlight:
              <DataTemplate x:Key="ExampleLinkTemplate">
                <go:LinkPanel go:Link.SelectionElementName="Path" go:Link.SelectionAdorned="True" >
                  <Path go:LinkPanel.IsLinkShape="True" 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 LinkPanel.Path property. All of rest will get the same route geometry as the primary LinkPanel.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>
            
In Silverlight:
              <go:LinkPanel . . .>
                <Path go:LinkPanel.IsLinkShape="True" StrokeThickness="7" Stroke="DarkBlue" />
                <Path go:LinkPanel.IsLinkShape="True" StrokeThickness="5" Stroke="Blue" />
                <Path go:LinkPanel.IsLinkShape="True" StrokeThickness="3" Stroke="LightBlue" />
                <Path go:LinkPanel.IsLinkShape="True" x:Name="Path" StrokeThickness="1" Stroke="White" />
                . . .
              </go:LinkPanel>
            

By default each LinkPanel sets UseLayoutRounding to false.

Inheritance Hierarchy

System.Object
   System.Windows.DependencyObject
      System.Windows.UIElement
         System.Windows.FrameworkElement
            System.Windows.Controls.Panel
               Northwoods.GoXam.LinkPanel

Requirements

See Also

© 2010 All Rights Reserved.