Class RowDefinition

GoDiagram®
v10.0.11
by Northwoods Software®

The RowDefinition class describes constraints on a row in a Panel of type PanelLayoutTable. It also provides information about the actual layout after the Table Panel has been arranged.

Inheritance
RowDefinition
Namespace: Northwoods.Go
Assembly: Northwoods.GoDiagram.WinForms.dll
Syntax
public class RowDefinition

Constructors

RowDefinition()

You should not use this Constructor, because calls to GetRowDefinition(int) will automatically create and remember a RowDefinition for you.

Declaration
public RowDefinition()

Properties

ActualHeight

Gets or sets the usable row height, after arrangement, in local coordinates, that objects in this row can be arranged within.

Declaration
public double ActualHeight { get; set; }
Property Value
Type Description
double
Remarks

This does not include SeparatorPadding or SeparatorStrokeWidth, as TotalHeight does.

The value is meaningless until after the Table Panel using this RowDefinition has been arranged.

It is very uncommon to set this property.

See Also

ActualY

Gets or sets the actual arranged row starting Y position, after arrangement, in local coordinates.

Declaration
public double ActualY { get; set; }
Property Value
Type Description
double
Remarks

The value is meaningless until after the Table Panel using this RowDefinition has been arranged.

It is very uncommon to set this property.

See Also

Alignment

Gets or sets a default alignment for elements that are in this row.

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

The value must be a Spot. The default value is Default, so that this RowDefinition does not supply any alignment information for the row.

When an element's Alignment property is Default, it gets the horizontal alignment from the element's column's Alignment and the vertical alignment from the element's row's Alignment. When that property is also Default, it takes the value from the table panel's DefaultAlignment property.

See Also

Background

Gets or sets the background color for a particular row, which fills the entire span of the row, including any SeparatorPadding.

Declaration
public Brush Background { get; set; }
Property Value
Type Description
Brush
Remarks

The default value is null, which means nothing is drawn in the background of the row.

See Also

CoversSeparators

Gets or sets whether or not the Background, if there is one, is in front of or behind the separators.

Declaration
public bool CoversSeparators { get; set; }
Property Value
Type Description
bool
Remarks

The default value is false -- any background is drawn behind any separator lines.

Height

Gets or sets the row height, in local coordinates.

Declaration
public double Height { get; set; }
Property Value
Type Description
double
Remarks

The value must be non-negative and finite.

The default value is NaN, which means this Row will get a height that is just big enough to hold all of the objects in the row.

Setting this Value to a number will mean that all of the objects of this Panel in this Row will be allocated that amount of row height. Whether an object in the row is actually arranged to have that height depends on whether the Stretch stretches vertically.

See Also

MaxHeight

Gets or sets the maximum row height, in local coordinates.

Declaration
public double MaxHeight { get; set; }
Property Value
Type Description
double
Remarks

The value must be non-negative. The default value is Infinity. The arranged height of all objects in this row will be no greater than this value.

See Also

MinHeight

Gets or sets the minimum row height, in local coordinates.

Declaration
public double MinHeight { get; set; }
Property Value
Type Description
double
Remarks

The value must be non-negative and finite. The default value is zero. The arranged height of all objects in this row will be no less than this value.

See Also

Panel

This read-only property returns the Panel that this row definition is in.

Declaration
public Panel Panel { get; }
Property Value
Type Description
Panel

Row

Gets or sets which row this RowDefinition describes in the Panel. The value is a zero-based integer.

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

This property can only be set on init.

See Also

SeparatorDashArray

Gets or sets the dash array for dashing the separator line, provided this row has a nonzero SeparatorStrokeWidth and non-null SeparatorStroke.

Declaration
public float[] SeparatorDashArray { get; set; }
Property Value
Type Description
float[]
Remarks

Must be an array of positive numbers and zeroes, or else null to indicate a solid line.

For example, the array [5, 10] would create dashes of 5 pixels and spaces of 10 pixels.

Setting an array with all zeroes will set the value to null.

Default is null, so that this RowDefinition does not supply any stroke dash array information for what is drawn before the row. The separator line may still be drawn using dashes if DefaultRowSeparatorDashArray is non-null.

See Also

SeparatorPadding

Gets or sets the additional padding for a particular row, in local coordinates.

Declaration
public Margin? SeparatorPadding { get; set; }
Property Value
Type Description
Margin?
Remarks

Padding is applied on two sides - before and after a row's contents. The SeparatorStrokeWidth comes before any padding Top.

The default value is null, so that this RowDefinition does not supply any padding information for the row. There may still be some padding between rows if DefaultSeparatorPadding is non-zero.

See Also

SeparatorStroke

Gets or sets the stroke (color) for the separator line that is drawn before a particular row, provided that row has a nonzero SeparatorStrokeWidth.

Declaration
public Brush SeparatorStroke { get; set; }
Property Value
Type Description
Brush
Remarks

The default value is null, so that this RowDefinition does not specify any brush for the separator line to draw before the row. The line may still be drawn if the value of DefaultRowSeparatorStroke is non-null.

However, if no stroke color is specified, then no stroke width will be drawn, even if the SeparatorStrokeWidth value is non-zero.

See Also

SeparatorStrokeWidth

Gets or sets the stroke width for a particular row's separator line, in local coordinates.

Declaration
public double SeparatorStrokeWidth { get; set; }
Property Value
Type Description
double
Remarks

The default value is NaN, so that this RowDefinition does not supply any stroke width information for what is drawn before the row. The separator line may still be drawn if DefaultRowSeparatorStroke is a real number (defaults to 1).

See Also

Sizing

Gets or sets how this row deals with a Table Panel's extra space.

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

The value must be one of: None, ProportionalExtra, or Default. The default value is Default.

See Also

Stretch

Gets or sets the default stretch for elements that are in this row.

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

The default value is Default, so that this RowDefinition does not supply any stretch information for the row.

When an element's Stretch property is Default, it gets the horizontal stretch from the element's column's Stretch and the vertical stretch from the element's row's Stretch. When that property is also Default, it takes the value from the table panel's DefaultStretch property.

See Also

TotalHeight

This read-only property returns the total arranged row height, after arrangement, in local coordinates.

Declaration
public double TotalHeight { get; }
Property Value
Type Description
double
Remarks

This value gives the ActualHeight size plus the SeparatorPadding and SeparatorStrokeWidth.

This value gives the vertical space occupied by the row. The value is meaningless until after the Table Panel using this RowDefinition has been arranged.

See Also

Methods

Apply(Action<RowDefinition>)

Applies the given function to this RowDefinition and returns it.

Declaration
public RowDefinition Apply(Action<RowDefinition> func)
Parameters
Type Name Description
Action<RowDefinition> func

the function to apply to the RowDefinition

Returns
Type Description
RowDefinition

this RowDefinition

Remarks

This method is often used to apply some common styling to a number of templates.

// define some common property settings
void tableStyle(RowDefinition cd) {
  cd.Bind("SeparatorStroke", "Color");
}

var template1 =
  new Node("Table") { ... }
    .Add(
      new RowDefinition().Apply(tableStyle)
    );

var template2 =
  new Node("Table") { ... }
    .Add(
      new RowDefinition().Apply(tableStyle)
    );

Bind(params Binding[])

Add a number of data-bindings to this RowDefinition.

Declaration
public RowDefinition Bind(params Binding[] bindings)
Parameters
Type Name Description
Binding[] bindings

the Bindings

Returns
Type Description
RowDefinition

this RowDefinition

Remarks

Do not add, modify, or remove object Bindings after this object has been copied.

Read more about Bindings at the Introduction page about Data Bindings.

Bind(IEnumerable<Binding>)

Add a number of data-bindings to this RowDefinition.

Declaration
public RowDefinition Bind(IEnumerable<Binding> bindings)
Parameters
Type Name Description
IEnumerable<Binding> bindings

a collection of Bindings

Returns
Type Description
RowDefinition

this RowDefinition

Remarks

Do not add, modify, or remove object Bindings after this object has been copied.

Read more about Bindings at the Introduction page about Data Bindings.

Bind(string, SimpleConversion, BackConversion)

Add a data-binding to this RowDefinition for the given property name and optional conversion functions.

Declaration
public RowDefinition Bind(string prop, SimpleConversion conv, BackConversion backconv = null)
Parameters
Type Name Description
string prop

the source and target property name

SimpleConversion conv

an optional conversion function

BackConversion backconv

an optional back-conversion function

Returns
Type Description
RowDefinition

this RowDefinition

Bind(string, SimpleConversion, SimpleConversion)

Add a data-binding to this RowDefinition for the given property name and optional conversion functions.

Declaration
public RowDefinition Bind(string prop, SimpleConversion conv, SimpleConversion backconv)
Parameters
Type Name Description
string prop

the source and target property name

SimpleConversion conv

an optional conversion function

SimpleConversion backconv

an optional back-conversion function

Returns
Type Description
RowDefinition

this RowDefinition

Bind(string, TargetConversion, BackConversion)

Add a data-binding to this RowDefinition for the given property name and optional conversion functions.

Declaration
public RowDefinition Bind(string prop, TargetConversion conv = null, BackConversion backconv = null)
Parameters
Type Name Description
string prop

the source and target property name

TargetConversion conv

an optional conversion function

BackConversion backconv

an optional back-conversion function

Returns
Type Description
RowDefinition

this RowDefinition

Bind(string, TargetConversion, SimpleConversion)

Add a data-binding to this RowDefinition for the given property name and optional conversion functions.

Declaration
public RowDefinition Bind(string prop, TargetConversion conv, SimpleConversion backconv)
Parameters
Type Name Description
string prop

the source and target property name

TargetConversion conv

an optional conversion function

SimpleConversion backconv

an optional back-conversion function

Returns
Type Description
RowDefinition

this RowDefinition

Bind(string, string, SimpleConversion, BackConversion)

Add a data-binding to this RowDefinition for the given property names and conversion functions.

Declaration
public RowDefinition Bind(string targetprop, string sourceprop, SimpleConversion conv, BackConversion backconv = null)
Parameters
Type Name Description
string targetprop

the target property on the RowDefinition

string sourceprop

the source property on the data object

SimpleConversion conv

an optional conversion function

BackConversion backconv

an optional back-conversion function

Returns
Type Description
RowDefinition

this RowDefinition

Bind(string, string, SimpleConversion, SimpleConversion)

Add a data-binding to this RowDefinition for the given property names and conversion functions.

Declaration
public RowDefinition Bind(string targetprop, string sourceprop, SimpleConversion conv, SimpleConversion backconv)
Parameters
Type Name Description
string targetprop

the target property on the RowDefinition

string sourceprop

the source property on the data object

SimpleConversion conv

an optional conversion function

SimpleConversion backconv

an optional back-conversion function

Returns
Type Description
RowDefinition

this RowDefinition

Bind(string, string, TargetConversion, BackConversion)

Add a data-binding to this RowDefinition for the given property names and conversion functions.

Declaration
public RowDefinition Bind(string targetprop, string sourceprop, TargetConversion conv = null, BackConversion backconv = null)
Parameters
Type Name Description
string targetprop

the target property on the RowDefinition

string sourceprop

the source property on the data object

TargetConversion conv

an optional conversion function

BackConversion backconv

an optional back-conversion function

Returns
Type Description
RowDefinition

this RowDefinition

Bind(string, string, TargetConversion, SimpleConversion)

Add a data-binding to this RowDefinition for the given property names and conversion functions.

Declaration
public RowDefinition Bind(string targetprop, string sourceprop, TargetConversion conv, SimpleConversion backconv)
Parameters
Type Name Description
string targetprop

the target property on the RowDefinition

string sourceprop

the source property on the data object

TargetConversion conv

an optional conversion function

SimpleConversion backconv

an optional back-conversion function

Returns
Type Description
RowDefinition

this RowDefinition

Set(RowDefinition)

Set properties of this RowDefinition to the values of a "partial" RowDefinition.

Declaration
public RowDefinition Set(RowDefinition obj)
Parameters
Type Name Description
RowDefinition obj

the partial RowDefinition to use for setting properties

Returns
Type Description
RowDefinition

this RowDefinition

Remarks

Only properties that are different from the default for the RowDefinition will be set in this manner.

For example, the following will only set the Alignment and Stretch properties:

myColDef.Set(new RowDefinition {
  Alignment = Spot.Top,
  Stretch = Stretch.Vertical,
  MinHeight = 0  // won't be set, even if this RowDefinition's MinHeight isn't 0
})

Calling this method is much less efficient than setting properties directly. It's acceptable to call when constructing templates, as that will only happen once.

Set(object)

Set properties of this RowDefinition to the values of a given anonymous object.

Declaration
public RowDefinition Set(object props)
Parameters
Type Name Description
object props

the dynamic object of properties

Returns
Type Description
RowDefinition

this RowDefinition

Remarks

Calling this method is much less efficient than setting properties directly. It's acceptable to call when constructing templates, as that will only happen once.

Set(string, object)

Set a property of this RowDefinition to a value.

Declaration
public RowDefinition Set(string propertyname, object value)
Parameters
Type Name Description
string propertyname

the name of the property to set

object value

the value to set the property to

Returns
Type Description
RowDefinition

this RowDefinition

Remarks

Calling this method is much less efficient than setting properties directly. It's acceptable to call when constructing templates, as that will only happen once.