Table of Contents

Struct MagnetAnchor

Namespace
Nalu
Assembly
Nalu.Maui.Layouts.dll

An anchor of a MagnetView side to a pole of another node (or of the parent stage).

[TypeConverter(typeof(MagnetAnchorTypeConverter))]
public readonly record struct MagnetAnchor : IEquatable<MagnetAnchor>
Implements
Inherited Members

Remarks

XAML syntax: "target.Pole", "target.Pole,margin" or "target.Pole,margin,gone:goneMargin", e.g. "parent.Left", "avatar.Right,12", "avatar.Right,12,gone:0".

Constructors

MagnetAnchor(string, MagnetPole, double, double?)

An anchor of a MagnetView side to a pole of another node (or of the parent stage).

public MagnetAnchor(string Target, MagnetPole Pole, double Margin = 0, double? GoneMargin = null)

Parameters

Target string

The MagnetId of the target node, or Parent.

Pole MagnetPole

The target pole.

Margin double

The margin between the anchored side and the target pole.

GoneMargin double?

The margin used when the target view is collapsed (defaults to Margin).

Remarks

XAML syntax: "target.Pole", "target.Pole,margin" or "target.Pole,margin,gone:goneMargin", e.g. "parent.Left", "avatar.Right,12", "avatar.Right,12,gone:0".

Fields

Parent

The reserved identifier of the stage (the Magnet layout content area).

public const string Parent = "parent"

Field Value

string

Properties

EffectiveGoneMargin

Gets the effective margin used when the target is collapsed.

public double EffectiveGoneMargin { get; }

Property Value

double

GoneMargin

The margin used when the target view is collapsed (defaults to Margin).

public double? GoneMargin { get; init; }

Property Value

double?

IsHorizontal

Gets whether the pole belongs to the horizontal axis.

public bool IsHorizontal { get; }

Property Value

bool

Margin

The margin between the anchored side and the target pole.

public double Margin { get; init; }

Property Value

double

Pole

The target pole.

public MagnetPole Pole { get; init; }

Property Value

MagnetPole

Target

The MagnetId of the target node, or Parent.

public string Target { get; init; }

Property Value

string

TargetsParent

Gets whether this anchor targets the stage.

public bool TargetsParent { get; }

Property Value

bool

Methods

Diff(MagnetAnchor?, MagnetAnchor?)

Classifies the difference between two optional anchors.

public static MagnetChange Diff(MagnetAnchor? a, MagnetAnchor? b)

Parameters

a MagnetAnchor?
b MagnetAnchor?

Returns

MagnetChange

DiffWith(in MagnetAnchor)

Classifies the difference between this anchor and other.

public MagnetChange DiffWith(in MagnetAnchor other)

Parameters

other MagnetAnchor

Returns

MagnetChange

Parse(string)

Parses the XAML representation of an anchor.

public static MagnetAnchor Parse(string value)

Parameters

value string

Returns

MagnetAnchor

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Operators

implicit operator MagnetAnchor(string)

Implicitly parses the XAML representation of an anchor.

public static implicit operator MagnetAnchor(string value)

Parameters

value string

Returns

MagnetAnchor