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

This panel is used to draw regular grid patterns.

Syntax

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

Remarks

The typical GridPattern will have pairs of Paths as child elements. Each Path will have the attached property FigureProperty set to indicate whether the path should be a line or a bar, and whether the path has repeated horizontal or vertical segments.

The CellSize property controls the size of each cell.

A simple grid is defined by:

              <go:GridPattern CellSize="10 10" Width="200" Height="200">
                <Path Stroke="LightGray" StrokeThickness="1" go:GridPattern.Figure="HorizontalLine" />
                <Path Stroke="LightGray" StrokeThickness="1" go:GridPattern.Figure="VerticalLine" />
              </go:GridPattern>
            

You can also have repeating variations of the lines by having multiple Paths, where those after the first one in each direction have the IntervalProperty attached property to set integer values larger than one. The interval describes how often that path should be drawn. Note that the interval is an integer not a double because it is a multiple. So in the follow example, once every five lines there is a Gray line instead of a LightGray line -- in other words every 10 model units the line is LightGray, except that every 50 model units the line is Gray.

              <go:GridPattern CellSize="10 10" Width="200" Height="200">
                <Path Stroke="LightGray" StrokeThickness="1" go:GridPattern.Figure="HorizontalLine" />
                <Path Stroke="LightGray" StrokeThickness="1" go:GridPattern.Figure="VerticalLine" />
                <Path Stroke="Gray" StrokeThickness="1" go:GridPattern.Figure="HorizontalLine" go:GridPattern.Interval="5" />
                <Path Stroke="Gray" StrokeThickness="1" go:GridPattern.Figure="VerticalLine" go:GridPattern.Interval="5" />
              </go:GridPattern>
            

You can have alternating green bars by:

              <go:GridPattern CellSize="50 50" Width="200" Height="200">
                <Path Fill="LightGreen" go:GridPattern.Figure="HorizontalBar" go:GridPattern.Interval="2" />
              </go:GridPattern>
            

A GridPattern may be the value of a diagram's Diagram.GridPattern property. You will need to set Diagram.GridVisible to true. Such a GridPattern is automatically arranged to occupy the whole DiagramPanel's viewport; so you should not set its Width or Height. The GridPattern may be supplied as a property element value in XAML or as a DataTemplate specified as the diagram's GridPatternTemplate. If no Diagram.GridPattern property and no GridPatternTemplate are supplied, it will use a default template.

You should not apply any transformations to the Paths; that is reserved for GoXam's use. If the GridPattern is the whole diagram's Diagram.GridPattern, you should not apply any transformations to it at all.

Inheritance Hierarchy

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

Requirements

See Also

© 2010 All Rights Reserved.