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

This panel is useful for positioning child elements relative either to the bounds of a particular child or to a computed rectangle.

Syntax

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

Remarks

The child elements of a SpotPanel are positioned according the values of two attached properties: Spot and Alignment. Both property values are of type Spot. Typically each child will at least specify a value for the Spot attached property, and will also specify a value for Alignment for minor adjustments in the position.

The value of SpotPanel.GetSpot specifies a point in a rectangle where the element should be positioned. The value of SpotPanel.GetAlignment specifies what point of the element should be positioned at the spot point of the rectangle. Both properties default to Spot.Center -- the center of the element is centered inside the rectangle. (This panel ignores the FrameworkElement.HorizontalAlignment and VerticalAlignment properties.)

The rectangle used for determining spot points is given by the bounds of the child element of the panel that has the MainProperty set to true. If there is no such element, the value of ComputeBorder is used instead. By default ComputeBorder will return the desired size of the first child. However, the GroupPanel class overrides the ComputeBorder method to return values unrelated to any of this panel's children.

Here's an example of a SpotPanel as a DataTemplate for a node. This places text at various points around the main Rectangle.

              <go:SpotPanel go:Node.Resizable="True" go:Node.SelectionElementName="Rectangle">
                <Rectangle x:Name="Rectangle" go:SpotPanel.Main="True" Stroke="Black" StrokeThickness="1" Width="100" Height="100" />
                <TextBlock go:SpotPanel.Spot="TopLeft" go:SpotPanel.Alignment="TopLeft" Text="inside" />
                <TextBlock go:SpotPanel.Spot="TopLeft" go:SpotPanel.Alignment="BottomLeft" Text="atop" />
                <TextBlock go:SpotPanel.Spot="TopLeft" go:SpotPanel.Alignment="TopRight" Text="aside" />
                <TextBlock go:SpotPanel.Spot="Center" go:SpotPanel.Alignment="Center" Text="center" />
                <TextBlock go:SpotPanel.Spot="1 0.7 -20 0" Text="-20" />
                <TextBlock go:SpotPanel.Spot="1 0.7 0 0" Text="0" />
                <TextBlock go:SpotPanel.Spot="1 0.7 20 0" Text="+20" />
              </go:SpotPanel>
            

A SpotPanel has a special usage when it is the Node.LocationElement of an Adornment and there is no child that is the "Main" child -- ComputeBorder returns the size of the AdornedElement.

Inheritance Hierarchy

System.Object
   System.Windows.DependencyObject
      System.Windows.UIElement
         System.Windows.FrameworkElement
            System.Windows.Controls.Panel
               Northwoods.GoXam.SpotPanel
                  Northwoods.GoXam.GroupPanel

Requirements

See Also

© 2010 All Rights Reserved.