Table of Contents

Class MagnetChain

Namespace
Nalu
Assembly
Nalu.Maui.Layouts.dll

Lays a group of views out along one axis (explicit chain).

[ContentProperty("Nodes")]
public sealed class MagnetChain : MagnetNode, INotifyPropertyChanged
Inheritance
MagnetChain
Implements
Inherited Members

Remarks

The chain start is the first member's anchor on the axis start side (LeftTo/TopTo, defaults to the stage start), the chain end is the last member's anchor on the axis end side (RightTo/BottomTo, defaults to the stage end). Inner members must not carry anchors on the chain axis, except anchors to the adjacent member which only contribute their margin. Members sized Constraint share the remaining space according to Weights.

Constructors

MagnetChain()

Initializes a new instance of the MagnetChain class.

public MagnetChain()

Properties

Gap

Gets or sets the uniform gap placed between consecutive VISIBLE members (separator semantics: a collapsed member takes its gap away — no gone margins to think about). Animatable.

public double Gap { get; set; }

Property Value

double

Remarks

Applies to member pairs with no adjacent-member anchors: declaring an anchor to the adjacent member (After="a,8") overrides the chain gap for that pair with the per-anchor margin/gone semantics.

GapMode

Gets or sets how the margins between members are interpreted. Defaults to Anchors (ConstraintLayout semantics); with Separators the head/tail margins belong to the chain and survive their member collapsing, and inner margins apply only between visible members (a StackLayout-like padding+spacing model — the first visible member sits at the chain's leading margin, whichever member it is).

public MagnetChainGapMode GapMode { get; set; }

Property Value

MagnetChainGapMode

Nodes

Gets or sets the ordered identifiers of the member views (XAML: <x:String> items or a comma-separated attribute, Nodes="a,b").

[TypeConverter(typeof(MagnetNodeIdsTypeConverter))]
public IList<string> Nodes { get; set; }

Property Value

IList<string>

Remarks

The setter replaces the contents: the backing list never changes identity.

Orientation

Gets or sets the axis of the chain.

public MagnetOrientation Orientation { get; set; }

Property Value

MagnetOrientation

Style

Gets or sets the distribution style.

public MagnetChainStyle Style { get; set; }

Property Value

MagnetChainStyle

Weights

Gets or sets the weights of the members (positional, aligned with Nodes, applies to Constraint-sized members only; missing entries default to 1). Collapsed members are excluded: their share is redistributed to the visible weighted members. XAML: a comma-separated attribute, Weights="2,1".

[TypeConverter(typeof(MagnetWeightsTypeConverter))]
public IList<double> Weights { get; set; }

Property Value

IList<double>

Remarks

The setter replaces the contents: the backing list never changes identity.

Methods

With(params BindableObject[])

Adds members given as views carrying Magnet.MagnetId (fluent).

public MagnetChain With(params BindableObject[] elements)

Parameters

elements BindableObject[]

Returns

MagnetChain

With(params MagnetNode[])

Adds members given as nodes (fluent).

public MagnetChain With(params MagnetNode[] elements)

Parameters

elements MagnetNode[]

Returns

MagnetChain

With(params string[])

Adds members (fluent).

public MagnetChain With(params string[] elements)

Parameters

elements string[]

Returns

MagnetChain