Class TableLayout

GoDiagram®
v10.0.11
by Northwoods Software®

This Layout positions non-Link Parts into a table according to the values of Row, Column, RowSpan, ColumnSpan, Alignment, Stretch.

Inheritance
TableLayout
Namespace: Northwoods.Go.Layouts.Extensions
Assembly: TableAvalonia.dll
Syntax
public class TableLayout : Layout
Remarks

If the value of GraphObject.Stretch is not None, the Part will be sized according to the available space in the cell(s).

You can specify constraints for whole rows or columns by calling GetRowDefinition(int) or GetColumnDefinition(int) and setting one of the following properties: Alignment, Height, MaxHeight, MinHeight (or their column equivalents), Stretch, or in bulk by calling Add(params RowDefinition[]).

The DefaultAlignment and DefaultStretch properties apply to all parts if not specified on the individual Part or in the corresponding row or column definition.

At the current time, there is no support for separator lines (SeparatorStroke, SeparatorStrokeWidth, and SeparatorDashArray properties) nor background (Background and CoversSeparators properties). There is no support for Sizing, either.

Constructors

TableLayout()

Create a Table layout.

Declaration
public TableLayout()

Properties

ColumnCount

This read-only property returns the number of columns in this TableLayout.

Declaration
public int ColumnCount { get; }
Property Value
Type Description
int
Remarks

This value is only valid after the layout has been performed.

DefaultAlignment

Gets or sets the alignment to use by default for Parts in rows (vertically) and in columns (horizontally).

Declaration
public Spot DefaultAlignment { get; set; }
Property Value
Type Description
Spot
Remarks

The default value is Default. Setting this property does not raise any events.

DefaultStretch

Gets or sets whether Parts should be stretched in rows (vertically) and in columns (horizontally).

Declaration
public Stretch DefaultStretch { get; set; }
Property Value
Type Description
Stretch
Remarks

The default value is Default. Setting this property does not raise any events.

RowCount

This read-only property returns the number of rows in this TableLayout.

Declaration
public int RowCount { get; }
Property Value
Type Description
int
Remarks

This value is only valid after the layout has been performed.

Methods

Add(params ColumnDefinition[])

Adds a number of ColumnDefinitions to this TableLayout.

Declaration
public TableLayout Add(params ColumnDefinition[] cols)
Parameters
Type Name Description
ColumnDefinition[] cols
Returns
Type Description
TableLayout

Add(params RowDefinition[])

Adds a number of RowDefinitions to this TableLayout.

Declaration
public TableLayout Add(params RowDefinition[] rows)
Parameters
Type Name Description
RowDefinition[] rows
Returns
Type Description
TableLayout

Add(IEnumerable<ColumnDefinition>)

Adds a number of ColumnDefinitions to this TableLayout.

Declaration
public TableLayout Add(IEnumerable<ColumnDefinition> cols)
Parameters
Type Name Description
IEnumerable<ColumnDefinition> cols
Returns
Type Description
TableLayout

Add(IEnumerable<RowDefinition>)

Adds a number of RowDefinitions to this TableLayout.

Declaration
public TableLayout Add(IEnumerable<RowDefinition> rows)
Parameters
Type Name Description
IEnumerable<RowDefinition> rows
Returns
Type Description
TableLayout

AfterArrange(List<Part>, DefaultDict<int, DefaultDict<int, List<Part>>>)

Override this method in order to perform some operations after arranging. By default this method does nothing.

Declaration
protected virtual void AfterArrange(List<Part> parts, DefaultDict<int, DefaultDict<int, List<Part>>> rowcol)
Parameters
Type Name Description
List<Part> parts
DefaultDict<int, DefaultDict<int, List<Part>>> rowcol

BeforeMeasure(List<Part>, DefaultDict<int, DefaultDict<int, List<Part>>>)

Override this method in order to perform some operations before measuring. By default this method does nothing.

Declaration
protected virtual void BeforeMeasure(List<Part> parts, DefaultDict<int, DefaultDict<int, List<Part>>> rowcol)
Parameters
Type Name Description
List<Part> parts
DefaultDict<int, DefaultDict<int, List<Part>>> rowcol

DoLayout(IEnumerable<Part>)

Assign the positions of the parts.

Declaration
public override void DoLayout(IEnumerable<Part> coll = null)
Parameters
Type Name Description
IEnumerable<Part> coll
Overrides

FindColumnForDocumentX(double)

Returns the column at a given x-coordinate in document coordinates.

Declaration
public int FindColumnForDocumentX(double x)
Parameters
Type Name Description
double x
Returns
Type Description
int

a zero-based integer

Remarks

This information is only valid when this layout has been performed and IsValidLayout is true.

If the point is to the left of column 0, this method returns -1. If the point is to the right of the last column, this returns the last column + 1.

See Also

FindRowForDocumentY(double)

Returns the row at a given y-coordinate in document coordinates.

Declaration
public int FindRowForDocumentY(double y)
Parameters
Type Name Description
double y
Returns
Type Description
int

a zero-based integer

Remarks

This information is only valid when this layout has been performed and IsValidLayout is true.

If the point is above row 0, this method returns -1. If the point is below the last row, this returns the last row + 1.

See Also

GetColumnDefinition(int)

Gets the ColumnDefinition for a particular column in this TableLayout.

Declaration
public ColumnDefinition GetColumnDefinition(int idx)
Parameters
Type Name Description
int idx

The non-negative zero-based integer column index.

Returns
Type Description
ColumnDefinition

ColumnDefinition

Remarks

If you ask for the definition of a column at or beyond the ColumnCount, it will automatically create one and return it.

GetRowDefinition(int)

Gets the RowDefinition for a particular row in this TableLayout.

Declaration
public RowDefinition GetRowDefinition(int idx)
Parameters
Type Name Description
int idx

The non-negative zero-based integer row index.

Returns
Type Description
RowDefinition

RowDefinition

Remarks

If you ask for the definition of a row at or beyond the RowCount, it will automatically create one and return it.