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

This panel is useful for having a background shape as the primary object and positioning one or more child elements within that shape.

Syntax

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

Remarks

A NodePanel is typically used as the implementation of a Node's DataTemplate when you want the node to basically be some shape (a "figure", but it can be any kind of UIElement) and you want to position and align additional elements within that primary shape. If you want elements such as text outside of that shape, we suggest you use a Panel such as StackPanel or Grid to arrange the node the way you want.

The first child element of the panel is treated as the main object. It can have two attached property values, NodePanel.Spot1 and NodePanel.Spot2, that denote the top-left and bottom-right corners of an area where the other child elements are placed. The default spot values will just cover the whole element. However, a NodeShape (WPF), or a Path (Silverlight), with a NodeFigure attached property is frequently used as the first element of a NodePanel. Such shapes have predefined Spot1 and Spot2 values in addition to having particular geometries.

The layout will observe the FrameworkElement.HorizontalAlignment and VerticalAlignment properties of each child element after the first one.

As an example, here is the definition of a simple template that displays a resizable rounded rectangle surrounding some text:

              <DataTemplate x:Key="ExampleNodeTemplate">
                <go:NodePanel go:Node.Location="{Binding Path=Data.XY, Mode=TwoWay}"
                              go:Node.SelectionElementName="Shape" go:Node.Resizable="True">
                  <go:NodeShape x:Name="Shape" go:NodePanel.Figure="RoundedRectangle" Width="50" Height="20"
                                Stroke="Gray" StrokeThickness="1" Fill="LightYellow" />
                  <TextBlock Text="{Binding Path=Data.Name}" TextWrapping="Wrap" />
                </go:NodePanel>
              </DataTemplate>
            
In WPF, you must use the <go:NodeShape> element instead of a <Path> element. In Silverlight 3, you must use the <Path> element instead of a <go:NodeShape> element. In Silverlight 4, you may use either the <Path> element or a <go:NodeShape> element.

Inheritance Hierarchy

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

Requirements

See Also

© 2010 All Rights Reserved.