Class RowDefinition
- Namespace
- Northwoods.Go
- Assembly
- Northwoods.GoDiagram.WinForms.dll
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.
public class RowDefinition
- Inheritance
-
RowDefinition
- Inherited Members
Constructors
RowDefinition()
You should not use this Constructor, because calls to GetRowDefinition(int) will automatically create and remember a RowDefinition for you.
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.
public double ActualHeight { get; set; }
Property Value
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.
public double ActualY { get; set; }
Property Value
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.
public Spot Alignment { get; set; }
Property Value
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.
public Brush Background { get; set; }
Property Value
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.
public bool CoversSeparators { get; set; }
Property Value
Remarks
The default value is false -- any background is drawn behind any separator lines.
Height
Gets or sets the row height, in local coordinates.
public double Height { get; set; }
Property Value
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.
public double MaxHeight { get; set; }
Property Value
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.
public double MinHeight { get; set; }
Property Value
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.
public Panel Panel { get; }
Property Value
Row
Gets or sets which row this RowDefinition describes in the Panel. The value is a zero-based integer.
public int Row { get; init; }
Property Value
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.
public float[] SeparatorDashArray { get; set; }
Property Value
- 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.
public Margin? SeparatorPadding { get; set; }
Property Value
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.
public Brush SeparatorStroke { get; set; }
Property Value
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.
public double SeparatorStrokeWidth { get; set; }
Property Value
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.
public Sizing Sizing { get; set; }
Property Value
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.
public Stretch Stretch { get; set; }
Property Value
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.
public double TotalHeight { get; }
Property Value
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.
public RowDefinition Apply(Action<RowDefinition> func)
Parameters
func
Action<RowDefinition>the function to apply to the RowDefinition
Returns
- 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.
public RowDefinition Bind(params Binding[] bindings)
Parameters
bindings
Binding[]the Bindings
Returns
- 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.
public RowDefinition Bind(IEnumerable<Binding> bindings)
Parameters
bindings
IEnumerable<Binding>a collection of Bindings
Returns
- 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.
public RowDefinition Bind(string prop, SimpleConversion conv, BackConversion backconv = null)
Parameters
prop
stringthe source and target property name
conv
SimpleConversionan optional conversion function
backconv
BackConversionan optional back-conversion function
Returns
- RowDefinition
this RowDefinition
Bind(string, SimpleConversion, SimpleConversion)
Add a data-binding to this RowDefinition for the given property name and optional conversion functions.
public RowDefinition Bind(string prop, SimpleConversion conv, SimpleConversion backconv)
Parameters
prop
stringthe source and target property name
conv
SimpleConversionan optional conversion function
backconv
SimpleConversionan optional back-conversion function
Returns
- RowDefinition
this RowDefinition
Bind(string, TargetConversion, BackConversion)
Add a data-binding to this RowDefinition for the given property name and optional conversion functions.
public RowDefinition Bind(string prop, TargetConversion conv = null, BackConversion backconv = null)
Parameters
prop
stringthe source and target property name
conv
TargetConversionan optional conversion function
backconv
BackConversionan optional back-conversion function
Returns
- RowDefinition
this RowDefinition
Bind(string, TargetConversion, SimpleConversion)
Add a data-binding to this RowDefinition for the given property name and optional conversion functions.
public RowDefinition Bind(string prop, TargetConversion conv, SimpleConversion backconv)
Parameters
prop
stringthe source and target property name
conv
TargetConversionan optional conversion function
backconv
SimpleConversionan optional back-conversion function
Returns
- RowDefinition
this RowDefinition
Bind(string, string, SimpleConversion, BackConversion)
Add a data-binding to this RowDefinition for the given property names and conversion functions.
public RowDefinition Bind(string targetprop, string sourceprop, SimpleConversion conv, BackConversion backconv = null)
Parameters
targetprop
stringthe target property on the RowDefinition
sourceprop
stringthe source property on the data object
conv
SimpleConversionan optional conversion function
backconv
BackConversionan optional back-conversion function
Returns
- RowDefinition
this RowDefinition
Bind(string, string, SimpleConversion, SimpleConversion)
Add a data-binding to this RowDefinition for the given property names and conversion functions.
public RowDefinition Bind(string targetprop, string sourceprop, SimpleConversion conv, SimpleConversion backconv)
Parameters
targetprop
stringthe target property on the RowDefinition
sourceprop
stringthe source property on the data object
conv
SimpleConversionan optional conversion function
backconv
SimpleConversionan optional back-conversion function
Returns
- RowDefinition
this RowDefinition
Bind(string, string, TargetConversion, BackConversion)
Add a data-binding to this RowDefinition for the given property names and conversion functions.
public RowDefinition Bind(string targetprop, string sourceprop, TargetConversion conv = null, BackConversion backconv = null)
Parameters
targetprop
stringthe target property on the RowDefinition
sourceprop
stringthe source property on the data object
conv
TargetConversionan optional conversion function
backconv
BackConversionan optional back-conversion function
Returns
- RowDefinition
this RowDefinition
Bind(string, string, TargetConversion, SimpleConversion)
Add a data-binding to this RowDefinition for the given property names and conversion functions.
public RowDefinition Bind(string targetprop, string sourceprop, TargetConversion conv, SimpleConversion backconv)
Parameters
targetprop
stringthe target property on the RowDefinition
sourceprop
stringthe source property on the data object
conv
TargetConversionan optional conversion function
backconv
SimpleConversionan optional back-conversion function
Returns
- RowDefinition
this RowDefinition
BindTwoWay(string, SimpleConversion, BackConversion)
This convenience function works like Bind(string, TargetConversion, BackConversion), creating a Binding, then also calls MakeTwoWay(BackConversion) on it.
public RowDefinition BindTwoWay(string prop, SimpleConversion conv, BackConversion backconv = null)
Parameters
prop
stringA string naming the source and target property on the target object. This should not be the empty-string.
conv
SimpleConversionAn optional side-effect-free function converting the data property value to the value to set the target property. If the function is null or not supplied, no conversion takes place.
backconv
BackConversionAn optional conversion function to convert property values back to data values. Specifying this modifies the binding to set its Mode to be TwoWay.
Returns
- RowDefinition
this RowDefinition
Remarks
Read more about Bindings at the Introduction page about Data Bindings.
BindTwoWay(string, SimpleConversion, SimpleConversion)
This convenience function works like Bind(string, TargetConversion, BackConversion), creating a Binding, then also calls MakeTwoWay(BackConversion) on it.
public RowDefinition BindTwoWay(string prop, SimpleConversion conv, SimpleConversion backconv)
Parameters
prop
stringA string naming the source and target property on the target object. This should not be the empty-string.
conv
SimpleConversionAn optional side-effect-free function converting the data property value to the value to set the target property. If the function is null or not supplied, no conversion takes place.
backconv
SimpleConversionAn optional conversion function to convert property values back to data values. Specifying this modifies the binding to set its Mode to be TwoWay.
Returns
- RowDefinition
this RowDefinition
Remarks
Read more about Bindings at the Introduction page about Data Bindings.
BindTwoWay(string, TargetConversion, BackConversion)
This convenience function works like Bind(string, TargetConversion, BackConversion), creating a Binding, then also calls MakeTwoWay(BackConversion) on it.
public RowDefinition BindTwoWay(string prop, TargetConversion conv = null, BackConversion backconv = null)
Parameters
prop
stringA string naming the source and target property on the target object. This should not be the empty-string.
conv
TargetConversionAn optional side-effect-free function converting the data property value to the value to set the target property. If the function is null or not supplied, no conversion takes place.
backconv
BackConversionAn optional conversion function to convert property values back to data values. Specifying this modifies the binding to set its Mode to be TwoWay.
Returns
- RowDefinition
this RowDefinition
Remarks
Read more about Bindings at the Introduction page about Data Bindings.
BindTwoWay(string, TargetConversion, SimpleConversion)
This convenience function works like Bind(string, TargetConversion, BackConversion), creating a Binding, then also calls MakeTwoWay(BackConversion) on it.
public RowDefinition BindTwoWay(string prop, TargetConversion conv, SimpleConversion backconv)
Parameters
prop
stringA string naming the source and target property on the target object. This should not be the empty-string.
conv
TargetConversionAn optional side-effect-free function converting the data property value to the value to set the target property. If the function is null or not supplied, no conversion takes place.
backconv
SimpleConversionAn optional conversion function to convert property values back to data values. Specifying this modifies the binding to set its Mode to be TwoWay.
Returns
- RowDefinition
this RowDefinition
Remarks
Read more about Bindings at the Introduction page about Data Bindings.
BindTwoWay(string, string, SimpleConversion, BackConversion)
This convenience function works like Bind(string, string, TargetConversion, BackConversion), creating a Binding, then also calls MakeTwoWay(BackConversion) on it.
public RowDefinition BindTwoWay(string targetprop, string sourceprop, SimpleConversion conv, BackConversion backconv = null)
Parameters
targetprop
stringA string naming the target property on the target object. This should not be the empty-string.
sourceprop
stringA string name the source property on the bound data object If this is the empty string, the whole Data object is used.
conv
SimpleConversionAn optional side-effect-free function converting the data property value to the value to set the target property. If the function is null or not supplied, no conversion takes place.
backconv
BackConversionAn optional conversion function to convert property values back to data values. Specifying this modifies the binding to set its Mode to be TwoWay.
Returns
- RowDefinition
this RowDefinition
Remarks
Read more about Bindings at the Introduction page about Data Bindings.
BindTwoWay(string, string, SimpleConversion, SimpleConversion)
This convenience function works like Bind(string, string, TargetConversion, BackConversion), creating a Binding, then also calls MakeTwoWay(BackConversion) on it.
public RowDefinition BindTwoWay(string targetprop, string sourceprop, SimpleConversion conv, SimpleConversion backconv)
Parameters
targetprop
stringA string naming the target property on the target object. This should not be the empty-string.
sourceprop
stringA string name the source property on the bound data object If this is the empty string, the whole Data object is used.
conv
SimpleConversionAn optional side-effect-free function converting the data property value to the value to set the target property. If the function is null or not supplied, no conversion takes place.
backconv
SimpleConversionAn optional conversion function to convert property values back to data values. Specifying this modifies the binding to set its Mode to be TwoWay.
Returns
- RowDefinition
this RowDefinition
Remarks
Read more about Bindings at the Introduction page about Data Bindings.
BindTwoWay(string, string, TargetConversion, BackConversion)
This convenience function works like Bind(string, string, TargetConversion, BackConversion), creating a Binding, then also calls MakeTwoWay(BackConversion) on it.
public RowDefinition BindTwoWay(string targetprop, string sourceprop, TargetConversion conv = null, BackConversion backconv = null)
Parameters
targetprop
stringA string naming the target property on the target object. This should not be the empty-string.
sourceprop
stringA string name the source property on the bound data object If this is the empty string, the whole Data object is used.
conv
TargetConversionAn optional side-effect-free function converting the data property value to the value to set the target property. If the function is null or not supplied, no conversion takes place.
backconv
BackConversionAn optional conversion function to convert property values back to data values. Specifying this modifies the binding to set its Mode to be TwoWay.
Returns
- RowDefinition
this RowDefinition
Remarks
Read more about Bindings at the Introduction page about Data Bindings.
BindTwoWay(string, string, TargetConversion, SimpleConversion)
Add a data-binding to this RowDefinition for the given property names and conversion functions.
public RowDefinition BindTwoWay(string targetprop, string sourceprop, TargetConversion conv, SimpleConversion backconv)
Parameters
targetprop
stringthe target property on the RowDefinition
sourceprop
stringthe source property on the data object
conv
TargetConversionan optional conversion function
backconv
SimpleConversionan optional back-conversion function
Returns
- RowDefinition
this RowDefinition
Set(RowDefinition)
Set properties of this RowDefinition to the values of a "partial" RowDefinition.
public RowDefinition Set(RowDefinition obj)
Parameters
obj
RowDefinitionthe partial RowDefinition to use for setting properties
Returns
- 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.
public RowDefinition Set(object props)
Parameters
props
objectthe dynamic object of properties
Returns
- 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.
public RowDefinition Set(string propertyname, object value)
Parameters
Returns
- 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.