Class TableLayout
- Namespace
- Northwoods.Go.Layouts.Extensions
- Assembly
- TableWinForms.dll
This Layout positions non-Link Parts into a table according to the values of Row, Column, RowSpan, ColumnSpan, Alignment, Stretch.
public class TableLayout : Layout
- Inheritance
-
TableLayout
- Inherited Members
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.
public TableLayout()
Properties
ColumnCount
This read-only property returns the number of columns in this TableLayout.
public int ColumnCount { get; }
Property Value
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).
public Spot DefaultAlignment { get; set; }
Property Value
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).
public Stretch DefaultStretch { get; set; }
Property Value
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.
public int RowCount { get; }
Property Value
Remarks
This value is only valid after the layout has been performed.
Methods
Add(params ColumnDefinition[])
Adds a number of ColumnDefinitions to this TableLayout.
public TableLayout Add(params ColumnDefinition[] cols)
Parameters
cols
ColumnDefinition[]
Returns
Add(params RowDefinition[])
Adds a number of RowDefinitions to this TableLayout.
public TableLayout Add(params RowDefinition[] rows)
Parameters
rows
RowDefinition[]
Returns
Add(IEnumerable<ColumnDefinition>)
Adds a number of ColumnDefinitions to this TableLayout.
public TableLayout Add(IEnumerable<ColumnDefinition> cols)
Parameters
cols
IEnumerable<ColumnDefinition>
Returns
Add(IEnumerable<RowDefinition>)
Adds a number of RowDefinitions to this TableLayout.
public TableLayout Add(IEnumerable<RowDefinition> rows)
Parameters
rows
IEnumerable<RowDefinition>
Returns
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.
protected virtual void AfterArrange(List<Part> parts, DefaultDict<int, DefaultDict<int, List<Part>>> rowcol)
Parameters
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.
protected virtual void BeforeMeasure(List<Part> parts, DefaultDict<int, DefaultDict<int, List<Part>>> rowcol)
Parameters
DoLayout(IEnumerable<Part>)
Assign the positions of the parts.
public override void DoLayout(IEnumerable<Part> coll = null)
Parameters
coll
IEnumerable<Part>
FindColumnForDocumentX(double)
Returns the column at a given x-coordinate in document coordinates.
public int FindColumnForDocumentX(double x)
Parameters
x
double
Returns
- 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.
public int FindRowForDocumentY(double y)
Parameters
y
double
Returns
- 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.
public ColumnDefinition GetColumnDefinition(int idx)
Parameters
idx
intThe non-negative zero-based integer column index.
Returns
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.
public RowDefinition GetRowDefinition(int idx)
Parameters
idx
intThe non-negative zero-based integer row index.
Returns
Remarks
If you ask for the definition of a row at or beyond the RowCount, it will automatically create one and return it.