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
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
HeightSizing
Gets or sets how the height is resolved. Defaults to Measured.
public MagnetSizing HeightSizing { get; set; }
Property Value
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
LeftTo
Gets or sets the anchor of the left side.
public MagnetAnchor? LeftTo { get; set; }
Property Value
RightTo
Gets or sets the anchor of the right side.
public MagnetAnchor? RightTo { get; set; }
Property Value
TopTo
Gets or sets the anchor of the top side.
public MagnetAnchor? TopTo { get; set; }
Property Value
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
WidthSizing
Gets or sets how the width is resolved. Defaults to Measured.
public MagnetSizing WidthSizing { get; set; }
Property Value
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
targetBindableObjectmargindoublegoneMargindouble?
Returns
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
targetMagnetNodemargindoublegoneMargindouble?
Returns
Above(MagnetTarget)
Places this view above the target: BottomTo = target.Top.
public MagnetView Above(MagnetTarget target)
Parameters
targetMagnetTarget
Returns
Above(string, double, double?)
Places this view above the target: BottomTo = target.Top.
public MagnetView Above(string target, double margin, double? goneMargin = null)
Parameters
Returns
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
targetBindableObjectmargindoublegoneMargindouble?
Returns
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
targetMagnetNodemargindoublegoneMargindouble?
Returns
After(MagnetTarget)
Places this view after (to the right of) the target: LeftTo = target.Right.
public MagnetView After(MagnetTarget target)
Parameters
targetMagnetTarget
Returns
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
Returns
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
targetBindableObjectmargindoublegoneMargindouble?
Returns
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
targetMagnetNodemargindoublegoneMargindouble?
Returns
AlignBottom(MagnetTarget)
Aligns the bottom side with the target's bottom side: BottomTo = target.Bottom.
public MagnetView AlignBottom(MagnetTarget target)
Parameters
targetMagnetTarget
Returns
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
Returns
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
targetBindableObjectmargindoublegoneMargindouble?
Returns
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
targetMagnetNodemargindoublegoneMargindouble?
Returns
AlignLeft(MagnetTarget)
Aligns the left side with the target's left side: LeftTo = target.Left.
public MagnetView AlignLeft(MagnetTarget target)
Parameters
targetMagnetTarget
Returns
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
Returns
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
targetBindableObjectmargindoublegoneMargindouble?
Returns
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
targetMagnetNodemargindoublegoneMargindouble?
Returns
AlignRight(MagnetTarget)
Aligns the right side with the target's right side: RightTo = target.Right.
public MagnetView AlignRight(MagnetTarget target)
Parameters
targetMagnetTarget
Returns
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
Returns
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
targetBindableObjectmargindoublegoneMargindouble?
Returns
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
targetMagnetNodemargindoublegoneMargindouble?
Returns
AlignTop(MagnetTarget)
Aligns the top side with the target's top side: TopTo = target.Top.
public MagnetView AlignTop(MagnetTarget target)
Parameters
targetMagnetTarget
Returns
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
Returns
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
targetBindableObjectmargindoublegoneMargindouble?
Returns
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
targetMagnetNodemargindoublegoneMargindouble?
Returns
Before(MagnetTarget)
Places this view before (to the left of) the target: RightTo = target.Left.
public MagnetView Before(MagnetTarget target)
Parameters
targetMagnetTarget
Returns
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
Returns
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
targetBindableObjectmargindoublegoneMargindouble?
Returns
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
targetMagnetNodemargindoublegoneMargindouble?
Returns
Below(MagnetTarget)
Places this view below the target: TopTo = target.Bottom.
public MagnetView Below(MagnetTarget target)
Parameters
targetMagnetTarget
Returns
Below(string, double, double?)
Places this view below the target: TopTo = target.Bottom.
public MagnetView Below(string target, double margin, double? goneMargin = null)
Parameters
Returns
Bias(double, double)
Sets horizontal and vertical bias.
public MagnetView Bias(double horizontal, double vertical)
Parameters
Returns
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
targetBindableObjectpoleMagnetPolemargindoublegoneMargindouble?
Returns
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
targetMagnetNodepoleMagnetPolemargindoublegoneMargindouble?
Returns
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
targetstringpoleMagnetPolemargindoublegoneMargindouble?
Returns
Fill(string, Thickness)
Anchors all four sides to the same node with the given margins.
public MagnetView Fill(string target, Thickness margin)
Parameters
Returns
FillHeight(BindableObject, double)
Anchors top and bottom to the target and sets Height="*".
public MagnetView FillHeight(BindableObject target, double margin = 0)
Parameters
targetBindableObjectmargindouble
Returns
FillHeight(MagnetNode, double)
Anchors top and bottom to the target and sets Height="*".
public MagnetView FillHeight(MagnetNode target, double margin = 0)
Parameters
targetMagnetNodemargindouble
Returns
FillHeight(MagnetTarget)
Anchors top and bottom to the target and sets Height="*".
public MagnetView FillHeight(MagnetTarget target)
Parameters
targetMagnetTarget
Returns
FillHeight(string, double)
Anchors top and bottom to the target and sets Height="*".
public MagnetView FillHeight(string target, double margin)
Parameters
Returns
FillWidth(BindableObject, double)
Anchors left and right to the target and sets Width="*".
public MagnetView FillWidth(BindableObject target, double margin = 0)
Parameters
targetBindableObjectmargindouble
Returns
FillWidth(MagnetNode, double)
Anchors left and right to the target and sets Width="*".
public MagnetView FillWidth(MagnetNode target, double margin = 0)
Parameters
targetMagnetNodemargindouble
Returns
FillWidth(MagnetTarget)
Anchors left and right to the target and sets Width="*".
public MagnetView FillWidth(MagnetTarget target)
Parameters
targetMagnetTarget
Returns
FillWidth(string, double)
Anchors left and right to the target and sets Width="*".
public MagnetView FillWidth(string target, double margin)
Parameters
Returns
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
targetBindableObjectmargindouble
Returns
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
targetMagnetNodemargindouble
Returns
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
targetMagnetTarget
Returns
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
Returns
Id(string)
Sets MagnetId.
public MagnetView Id(string magnetId)
Parameters
magnetIdstring
Returns
IdOf(BindableObject)
Resolves the MagnetId of a view used as a target.
public static string IdOf(BindableObject target)
Parameters
targetBindableObject
Returns
IdOf(MagnetNode)
Resolves the MagnetId of a view or node used as a target.
public static string IdOf(MagnetNode target)
Parameters
targetMagnetNode
Returns
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
targetBindableObjectpoleMagnetPolemargindoublegoneMargindouble?
Returns
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
targetMagnetNodepoleMagnetPolemargindoublegoneMargindouble?
Returns
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
targetstringpoleMagnetPolemargindoublegoneMargindouble?
Returns
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
targetBindableObjectpoleMagnetPolemargindoublegoneMargindouble?
Returns
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
targetMagnetNodepoleMagnetPolemargindoublegoneMargindouble?
Returns
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
targetstringpoleMagnetPolemargindoublegoneMargindouble?
Returns
Size(MagnetSizing, MagnetSizing)
Sets width and height.
public MagnetView Size(MagnetSizing width, MagnetSizing height)
Parameters
widthMagnetSizingheightMagnetSizing
Returns
Size(double, double)
Sets a fixed width and height.
public MagnetView Size(double width, double height)
Parameters
Returns
TargetOf(BindableObject, double, double?)
Builds a MagnetTarget from a view.
public static MagnetTarget TargetOf(BindableObject target, double margin = 0, double? goneMargin = null)
Parameters
targetBindableObjectmargindoublegoneMargindouble?
Returns
TargetOf(MagnetNode, double, double?)
Builds a MagnetTarget from a node.
public static MagnetTarget TargetOf(MagnetNode target, double margin = 0, double? goneMargin = null)
Parameters
targetMagnetNodemargindoublegoneMargindouble?
Returns
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
targetBindableObjectpoleMagnetPolemargindoublegoneMargindouble?
Returns
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
targetMagnetNodepoleMagnetPolemargindoublegoneMargindouble?
Returns
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
targetstringpoleMagnetPolemargindoublegoneMargindouble?
Returns
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
targetBindableObjectmargindouble
Returns
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
targetMagnetNodemargindouble
Returns
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
targetMagnetTarget
Returns
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
Returns
Visibility(MagnetVisibilityAction)
Sets ApplyVisibility (fluent).
public MagnetView Visibility(MagnetVisibilityAction action)
Parameters
actionMagnetVisibilityAction
Returns
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
targetBindableObjectmargindouble
Returns
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
targetMagnetNodemargindouble
Returns
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
targetMagnetTarget
Returns
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)