Table of Contents

Class MagnetView

Namespace
Nalu
Assembly
Nalu.Maui.Layouts.dll

The constraints of a view inside a Magnet layout.

public sealed class MagnetView : MagnetNode, INotifyPropertyChanged
Inheritance
MagnetView
Implements
Inherited Members

Remarks

The single source of truth for visibility is Visibility of the bound view (IsVisible="False" collapses the view, its size becomes 0 and anchors to it use GoneMargin). ApplyVisibility is a declared, one-shot action STAMPED onto that property when the node is applied — it is never read back and does not participate in the layout solve.

Properties

ApplyVisibility

Gets or sets the visibility action applied to the bound view's IsVisible — when the definition attaches, when the view binds (late-added child) and when this value changes. None (the default) leaves the view untouched.

public MagnetVisibilityAction ApplyVisibility { get; set; }

Property Value

MagnetVisibilityAction

Remarks

One-shot writes with standard MAUI semantics: applying detaches any binding on the view's IsVisible. A view whose visibility is scene-managed is owned by ApplyVisibility — do not also bind its IsVisible. Inside TransitionToAsync(Action, uint, Easing?) the write is deferred and animated (fade-out for Hide); scenes do not auto-revert: each definition declares the state of the views it manages.

BottomTo

Gets or sets the anchor of the bottom side.

public MagnetAnchor? BottomTo { get; set; }

Property Value

MagnetAnchor?

HeightSizing

Gets or sets how the height is resolved. Defaults to Measured.

public MagnetSizing HeightSizing { get; set; }

Property Value

MagnetSizing

HorizontalBias

Gets or sets the horizontal bias (0 = left, 1 = right) used when both horizontal anchors are set and the view does not fill the span. Also used as the bias of a packed horizontal chain when this view is the chain head.

public double HorizontalBias { get; set; }

Property Value

double

LeftTo

Gets or sets the anchor of the left side.

public MagnetAnchor? LeftTo { get; set; }

Property Value

MagnetAnchor?

RightTo

Gets or sets the anchor of the right side.

public MagnetAnchor? RightTo { get; set; }

Property Value

MagnetAnchor?

TopTo

Gets or sets the anchor of the top side.

public MagnetAnchor? TopTo { get; set; }

Property Value

MagnetAnchor?

VerticalBias

Gets or sets the vertical bias (0 = top, 1 = bottom) used when both vertical anchors are set and the view does not fill the span. Also used as the bias of a packed vertical chain when this view is the chain head.

public double VerticalBias { get; set; }

Property Value

double

WidthSizing

Gets or sets how the width is resolved. Defaults to Measured.

public MagnetSizing WidthSizing { get; set; }

Property Value

MagnetSizing

Methods

Above(BindableObject, double, double?)

Places this view above the target: BottomTo = target.Top.

public MagnetView Above(BindableObject target, double margin = 0, double? goneMargin = null)

Parameters

target BindableObject
margin double
goneMargin double?

Returns

MagnetView

Above(MagnetNode, double, double?)

Places this view above the target: BottomTo = target.Top.

public MagnetView Above(MagnetNode target, double margin = 0, double? goneMargin = null)

Parameters

target MagnetNode
margin double
goneMargin double?

Returns

MagnetView

Above(MagnetTarget)

Places this view above the target: BottomTo = target.Top.

public MagnetView Above(MagnetTarget target)

Parameters

target MagnetTarget

Returns

MagnetView

Above(string, double, double?)

Places this view above the target: BottomTo = target.Top.

public MagnetView Above(string target, double margin, double? goneMargin = null)

Parameters

target string
margin double
goneMargin double?

Returns

MagnetView

After(BindableObject, double, double?)

Places this view after (to the right of) the target: LeftTo = target.Right.

public MagnetView After(BindableObject target, double margin = 0, double? goneMargin = null)

Parameters

target BindableObject
margin double
goneMargin double?

Returns

MagnetView

After(MagnetNode, double, double?)

Places this view after (to the right of) the target: LeftTo = target.Right.

public MagnetView After(MagnetNode target, double margin = 0, double? goneMargin = null)

Parameters

target MagnetNode
margin double
goneMargin double?

Returns

MagnetView

After(MagnetTarget)

Places this view after (to the right of) the target: LeftTo = target.Right.

public MagnetView After(MagnetTarget target)

Parameters

target MagnetTarget

Returns

MagnetView

After(string, double, double?)

Places this view after (to the right of) the target: LeftTo = target.Right.

public MagnetView After(string target, double margin, double? goneMargin = null)

Parameters

target string
margin double
goneMargin double?

Returns

MagnetView

AlignBottom(BindableObject, double, double?)

Aligns the bottom side with the target's bottom side: BottomTo = target.Bottom.

public MagnetView AlignBottom(BindableObject target, double margin = 0, double? goneMargin = null)

Parameters

target BindableObject
margin double
goneMargin double?

Returns

MagnetView

AlignBottom(MagnetNode, double, double?)

Aligns the bottom side with the target's bottom side: BottomTo = target.Bottom.

public MagnetView AlignBottom(MagnetNode target, double margin = 0, double? goneMargin = null)

Parameters

target MagnetNode
margin double
goneMargin double?

Returns

MagnetView

AlignBottom(MagnetTarget)

Aligns the bottom side with the target's bottom side: BottomTo = target.Bottom.

public MagnetView AlignBottom(MagnetTarget target)

Parameters

target MagnetTarget

Returns

MagnetView

AlignBottom(string, double, double?)

Aligns the bottom side with the target's bottom side: BottomTo = target.Bottom.

public MagnetView AlignBottom(string target, double margin, double? goneMargin = null)

Parameters

target string
margin double
goneMargin double?

Returns

MagnetView

AlignLeft(BindableObject, double, double?)

Aligns the left side with the target's left side: LeftTo = target.Left.

public MagnetView AlignLeft(BindableObject target, double margin = 0, double? goneMargin = null)

Parameters

target BindableObject
margin double
goneMargin double?

Returns

MagnetView

AlignLeft(MagnetNode, double, double?)

Aligns the left side with the target's left side: LeftTo = target.Left.

public MagnetView AlignLeft(MagnetNode target, double margin = 0, double? goneMargin = null)

Parameters

target MagnetNode
margin double
goneMargin double?

Returns

MagnetView

AlignLeft(MagnetTarget)

Aligns the left side with the target's left side: LeftTo = target.Left.

public MagnetView AlignLeft(MagnetTarget target)

Parameters

target MagnetTarget

Returns

MagnetView

AlignLeft(string, double, double?)

Aligns the left side with the target's left side: LeftTo = target.Left.

public MagnetView AlignLeft(string target, double margin, double? goneMargin = null)

Parameters

target string
margin double
goneMargin double?

Returns

MagnetView

AlignRight(BindableObject, double, double?)

Aligns the right side with the target's right side: RightTo = target.Right.

public MagnetView AlignRight(BindableObject target, double margin = 0, double? goneMargin = null)

Parameters

target BindableObject
margin double
goneMargin double?

Returns

MagnetView

AlignRight(MagnetNode, double, double?)

Aligns the right side with the target's right side: RightTo = target.Right.

public MagnetView AlignRight(MagnetNode target, double margin = 0, double? goneMargin = null)

Parameters

target MagnetNode
margin double
goneMargin double?

Returns

MagnetView

AlignRight(MagnetTarget)

Aligns the right side with the target's right side: RightTo = target.Right.

public MagnetView AlignRight(MagnetTarget target)

Parameters

target MagnetTarget

Returns

MagnetView

AlignRight(string, double, double?)

Aligns the right side with the target's right side: RightTo = target.Right.

public MagnetView AlignRight(string target, double margin, double? goneMargin = null)

Parameters

target string
margin double
goneMargin double?

Returns

MagnetView

AlignTop(BindableObject, double, double?)

Aligns the top side with the target's top side: TopTo = target.Top.

public MagnetView AlignTop(BindableObject target, double margin = 0, double? goneMargin = null)

Parameters

target BindableObject
margin double
goneMargin double?

Returns

MagnetView

AlignTop(MagnetNode, double, double?)

Aligns the top side with the target's top side: TopTo = target.Top.

public MagnetView AlignTop(MagnetNode target, double margin = 0, double? goneMargin = null)

Parameters

target MagnetNode
margin double
goneMargin double?

Returns

MagnetView

AlignTop(MagnetTarget)

Aligns the top side with the target's top side: TopTo = target.Top.

public MagnetView AlignTop(MagnetTarget target)

Parameters

target MagnetTarget

Returns

MagnetView

AlignTop(string, double, double?)

Aligns the top side with the target's top side: TopTo = target.Top.

public MagnetView AlignTop(string target, double margin, double? goneMargin = null)

Parameters

target string
margin double
goneMargin double?

Returns

MagnetView

Before(BindableObject, double, double?)

Places this view before (to the left of) the target: RightTo = target.Left.

public MagnetView Before(BindableObject target, double margin = 0, double? goneMargin = null)

Parameters

target BindableObject
margin double
goneMargin double?

Returns

MagnetView

Before(MagnetNode, double, double?)

Places this view before (to the left of) the target: RightTo = target.Left.

public MagnetView Before(MagnetNode target, double margin = 0, double? goneMargin = null)

Parameters

target MagnetNode
margin double
goneMargin double?

Returns

MagnetView

Before(MagnetTarget)

Places this view before (to the left of) the target: RightTo = target.Left.

public MagnetView Before(MagnetTarget target)

Parameters

target MagnetTarget

Returns

MagnetView

Before(string, double, double?)

Places this view before (to the left of) the target: RightTo = target.Left.

public MagnetView Before(string target, double margin, double? goneMargin = null)

Parameters

target string
margin double
goneMargin double?

Returns

MagnetView

Below(BindableObject, double, double?)

Places this view below the target: TopTo = target.Bottom.

public MagnetView Below(BindableObject target, double margin = 0, double? goneMargin = null)

Parameters

target BindableObject
margin double
goneMargin double?

Returns

MagnetView

Below(MagnetNode, double, double?)

Places this view below the target: TopTo = target.Bottom.

public MagnetView Below(MagnetNode target, double margin = 0, double? goneMargin = null)

Parameters

target MagnetNode
margin double
goneMargin double?

Returns

MagnetView

Below(MagnetTarget)

Places this view below the target: TopTo = target.Bottom.

public MagnetView Below(MagnetTarget target)

Parameters

target MagnetTarget

Returns

MagnetView

Below(string, double, double?)

Places this view below the target: TopTo = target.Bottom.

public MagnetView Below(string target, double margin, double? goneMargin = null)

Parameters

target string
margin double
goneMargin double?

Returns

MagnetView

Bias(double, double)

Sets horizontal and vertical bias.

public MagnetView Bias(double horizontal, double vertical)

Parameters

horizontal double
vertical double

Returns

MagnetView

Bottom(BindableObject, MagnetPole, double, double?)

Anchors the bottom side.

public MagnetView Bottom(BindableObject target, MagnetPole pole = MagnetPole.Bottom, double margin = 0, double? goneMargin = null)

Parameters

target BindableObject
pole MagnetPole
margin double
goneMargin double?

Returns

MagnetView

Bottom(MagnetNode, MagnetPole, double, double?)

Anchors the bottom side.

public MagnetView Bottom(MagnetNode target, MagnetPole pole = MagnetPole.Bottom, double margin = 0, double? goneMargin = null)

Parameters

target MagnetNode
pole MagnetPole
margin double
goneMargin double?

Returns

MagnetView

Bottom(string, MagnetPole, double, double?)

Anchors the bottom side.

public MagnetView Bottom(string target, MagnetPole pole = MagnetPole.Bottom, double margin = 0, double? goneMargin = null)

Parameters

target string
pole MagnetPole
margin double
goneMargin double?

Returns

MagnetView

Fill(string, Thickness)

Anchors all four sides to the same node with the given margins.

public MagnetView Fill(string target, Thickness margin)

Parameters

target string
margin Thickness

Returns

MagnetView

FillHeight(BindableObject, double)

Anchors top and bottom to the target and sets Height="*".

public MagnetView FillHeight(BindableObject target, double margin = 0)

Parameters

target BindableObject
margin double

Returns

MagnetView

FillHeight(MagnetNode, double)

Anchors top and bottom to the target and sets Height="*".

public MagnetView FillHeight(MagnetNode target, double margin = 0)

Parameters

target MagnetNode
margin double

Returns

MagnetView

FillHeight(MagnetTarget)

Anchors top and bottom to the target and sets Height="*".

public MagnetView FillHeight(MagnetTarget target)

Parameters

target MagnetTarget

Returns

MagnetView

FillHeight(string, double)

Anchors top and bottom to the target and sets Height="*".

public MagnetView FillHeight(string target, double margin)

Parameters

target string
margin double

Returns

MagnetView

FillWidth(BindableObject, double)

Anchors left and right to the target and sets Width="*".

public MagnetView FillWidth(BindableObject target, double margin = 0)

Parameters

target BindableObject
margin double

Returns

MagnetView

FillWidth(MagnetNode, double)

Anchors left and right to the target and sets Width="*".

public MagnetView FillWidth(MagnetNode target, double margin = 0)

Parameters

target MagnetNode
margin double

Returns

MagnetView

FillWidth(MagnetTarget)

Anchors left and right to the target and sets Width="*".

public MagnetView FillWidth(MagnetTarget target)

Parameters

target MagnetTarget

Returns

MagnetView

FillWidth(string, double)

Anchors left and right to the target and sets Width="*".

public MagnetView FillWidth(string target, double margin)

Parameters

target string
margin double

Returns

MagnetView

HorizontallyWithin(BindableObject, double)

Anchors left and right to the target: the view is placed inside it by HorizontalBias (0.5 = centered).

public MagnetView HorizontallyWithin(BindableObject target, double margin = 0)

Parameters

target BindableObject
margin double

Returns

MagnetView

HorizontallyWithin(MagnetNode, double)

Anchors left and right to the target: the view is placed inside it by HorizontalBias (0.5 = centered).

public MagnetView HorizontallyWithin(MagnetNode target, double margin = 0)

Parameters

target MagnetNode
margin double

Returns

MagnetView

HorizontallyWithin(MagnetTarget)

Anchors left and right to the target: the view is placed inside it by HorizontalBias (0.5 = centered).

public MagnetView HorizontallyWithin(MagnetTarget target)

Parameters

target MagnetTarget

Returns

MagnetView

HorizontallyWithin(string, double)

Anchors left and right to the target: the view is placed inside it by HorizontalBias (0.5 = centered).

public MagnetView HorizontallyWithin(string target, double margin)

Parameters

target string
margin double

Returns

MagnetView

Id(string)

Sets MagnetId.

public MagnetView Id(string magnetId)

Parameters

magnetId string

Returns

MagnetView

IdOf(BindableObject)

Resolves the MagnetId of a view used as a target.

public static string IdOf(BindableObject target)

Parameters

target BindableObject

Returns

string

IdOf(MagnetNode)

Resolves the MagnetId of a view or node used as a target.

public static string IdOf(MagnetNode target)

Parameters

target MagnetNode

Returns

string

Left(BindableObject, MagnetPole, double, double?)

Anchors the left side.

public MagnetView Left(BindableObject target, MagnetPole pole = MagnetPole.Left, double margin = 0, double? goneMargin = null)

Parameters

target BindableObject
pole MagnetPole
margin double
goneMargin double?

Returns

MagnetView

Left(MagnetNode, MagnetPole, double, double?)

Anchors the left side.

public MagnetView Left(MagnetNode target, MagnetPole pole = MagnetPole.Left, double margin = 0, double? goneMargin = null)

Parameters

target MagnetNode
pole MagnetPole
margin double
goneMargin double?

Returns

MagnetView

Left(string, MagnetPole, double, double?)

Anchors the left side.

public MagnetView Left(string target, MagnetPole pole = MagnetPole.Left, double margin = 0, double? goneMargin = null)

Parameters

target string
pole MagnetPole
margin double
goneMargin double?

Returns

MagnetView

Right(BindableObject, MagnetPole, double, double?)

Anchors the right side.

public MagnetView Right(BindableObject target, MagnetPole pole = MagnetPole.Right, double margin = 0, double? goneMargin = null)

Parameters

target BindableObject
pole MagnetPole
margin double
goneMargin double?

Returns

MagnetView

Right(MagnetNode, MagnetPole, double, double?)

Anchors the right side.

public MagnetView Right(MagnetNode target, MagnetPole pole = MagnetPole.Right, double margin = 0, double? goneMargin = null)

Parameters

target MagnetNode
pole MagnetPole
margin double
goneMargin double?

Returns

MagnetView

Right(string, MagnetPole, double, double?)

Anchors the right side.

public MagnetView Right(string target, MagnetPole pole = MagnetPole.Right, double margin = 0, double? goneMargin = null)

Parameters

target string
pole MagnetPole
margin double
goneMargin double?

Returns

MagnetView

Size(MagnetSizing, MagnetSizing)

Sets width and height.

public MagnetView Size(MagnetSizing width, MagnetSizing height)

Parameters

width MagnetSizing
height MagnetSizing

Returns

MagnetView

Size(double, double)

Sets a fixed width and height.

public MagnetView Size(double width, double height)

Parameters

width double
height double

Returns

MagnetView

TargetOf(BindableObject, double, double?)

Builds a MagnetTarget from a view.

public static MagnetTarget TargetOf(BindableObject target, double margin = 0, double? goneMargin = null)

Parameters

target BindableObject
margin double
goneMargin double?

Returns

MagnetTarget

TargetOf(MagnetNode, double, double?)

Builds a MagnetTarget from a node.

public static MagnetTarget TargetOf(MagnetNode target, double margin = 0, double? goneMargin = null)

Parameters

target MagnetNode
margin double
goneMargin double?

Returns

MagnetTarget

Top(BindableObject, MagnetPole, double, double?)

Anchors the top side.

public MagnetView Top(BindableObject target, MagnetPole pole = MagnetPole.Top, double margin = 0, double? goneMargin = null)

Parameters

target BindableObject
pole MagnetPole
margin double
goneMargin double?

Returns

MagnetView

Top(MagnetNode, MagnetPole, double, double?)

Anchors the top side.

public MagnetView Top(MagnetNode target, MagnetPole pole = MagnetPole.Top, double margin = 0, double? goneMargin = null)

Parameters

target MagnetNode
pole MagnetPole
margin double
goneMargin double?

Returns

MagnetView

Top(string, MagnetPole, double, double?)

Anchors the top side.

public MagnetView Top(string target, MagnetPole pole = MagnetPole.Top, double margin = 0, double? goneMargin = null)

Parameters

target string
pole MagnetPole
margin double
goneMargin double?

Returns

MagnetView

VerticallyWithin(BindableObject, double)

Anchors top and bottom to the target: the view is placed inside it by VerticalBias (0.5 = centered).

public MagnetView VerticallyWithin(BindableObject target, double margin = 0)

Parameters

target BindableObject
margin double

Returns

MagnetView

VerticallyWithin(MagnetNode, double)

Anchors top and bottom to the target: the view is placed inside it by VerticalBias (0.5 = centered).

public MagnetView VerticallyWithin(MagnetNode target, double margin = 0)

Parameters

target MagnetNode
margin double

Returns

MagnetView

VerticallyWithin(MagnetTarget)

Anchors top and bottom to the target: the view is placed inside it by VerticalBias (0.5 = centered).

public MagnetView VerticallyWithin(MagnetTarget target)

Parameters

target MagnetTarget

Returns

MagnetView

VerticallyWithin(string, double)

Anchors top and bottom to the target: the view is placed inside it by VerticalBias (0.5 = centered).

public MagnetView VerticallyWithin(string target, double margin)

Parameters

target string
margin double

Returns

MagnetView

Visibility(MagnetVisibilityAction)

Sets ApplyVisibility (fluent).

public MagnetView Visibility(MagnetVisibilityAction action)

Parameters

action MagnetVisibilityAction

Returns

MagnetView

Within(BindableObject, double)

Anchors all four sides to the target: the view is placed inside it by the biases (0.5 = centered).

public MagnetView Within(BindableObject target, double margin = 0)

Parameters

target BindableObject
margin double

Returns

MagnetView

Within(MagnetNode, double)

Anchors all four sides to the target: the view is placed inside it by the biases (0.5 = centered).

public MagnetView Within(MagnetNode target, double margin = 0)

Parameters

target MagnetNode
margin double

Returns

MagnetView

Within(MagnetTarget)

Anchors all four sides to the target: the view is placed inside it by the biases (0.5 = centered).

public MagnetView Within(MagnetTarget target)

Parameters

target MagnetTarget

Returns

MagnetView

Within(string, double)

Anchors all four sides to the target: the view is placed inside it by the biases (0.5 = centered).

public MagnetView Within(string target, double margin)

Parameters

target string
margin double

Returns

MagnetView