Table of Contents

Class MagnetStage

Namespace
Nalu.MagnetLayout
Assembly
Nalu.Maui.Layouts.dll

The magnet stage.

public class MagnetStage : BindableObject, INotifyPropertyChanged, IMagnetStage, IVerticalPoles, IHorizontalPoles, IMagnetElementBase, IList<IMagnetElement>, ICollection<IMagnetElement>, IEnumerable<IMagnetElement>, IEnumerable
Inheritance
MagnetStage
Implements
Inherited Members
Extension Methods

Constructors

MagnetStage()

Initializes a new instance of the MagnetStage class.

public MagnetStage()

Properties

Bottom

Bottom pole of the element.

public Variable Bottom { get; }

Property Value

Variable

Count

Gets the number of elements contained in the ICollection<T>.

public int Count { get; }

Property Value

int

The number of elements contained in the ICollection<T>.

HeightRequest

The requested stage height.

public double HeightRequest { get; }

Property Value

double

Id

Gets the unique identifier for this element.

public string Id { get; }

Property Value

string

IsReadOnly

Gets a value indicating whether the ICollection<T> is read-only.

public bool IsReadOnly { get; }

Property Value

bool

true if the ICollection<T> is read-only; otherwise, false.

this[int]

Gets or sets the element at the specified index.

public IMagnetElement this[int index] { get; set; }

Parameters

index int

The zero-based index of the element to get or set.

Property Value

IMagnetElement

The element at the specified index.

Exceptions

ArgumentOutOfRangeException

index is not a valid index in the IList<T>.

NotSupportedException

The property is set and the IList<T> is read-only.

Left

Start pole of the element.

public Variable Left { get; }

Property Value

Variable

Right

End pole of the element.

public Variable Right { get; }

Property Value

Variable

Top

Top pole of the element.

public Variable Top { get; }

Property Value

Variable

WidthRequest

The requested stage width.

public double WidthRequest { get; }

Property Value

double

Methods

Add(IMagnetElement)

Adds an item to the ICollection<T>.

public void Add(IMagnetElement item)

Parameters

item IMagnetElement

The object to add to the ICollection<T>.

Exceptions

NotSupportedException

The ICollection<T> is read-only.

AddConstraint(Constraint)

Adds a constraint to the stage.

public void AddConstraint(Constraint constraint)

Parameters

constraint Constraint

AddEditVariable(Variable, double)

Adds an editable variable to the stage.

public void AddEditVariable(Variable variable, double strength)

Parameters

variable Variable

The editable variable.

strength double

The strength, defaults to Strong

Clear()

Removes all items from the ICollection<T>.

public void Clear()

Exceptions

NotSupportedException

The ICollection<T> is read-only.

Contains(IMagnetElement)

Determines whether the ICollection<T> contains a specific value.

public bool Contains(IMagnetElement item)

Parameters

item IMagnetElement

The object to locate in the ICollection<T>.

Returns

bool

true if item is found in the ICollection<T>; otherwise, false.

CopyTo(IMagnetElement[], int)

Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.

public void CopyTo(IMagnetElement[] array, int arrayIndex)

Parameters

array IMagnetElement[]

The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.

arrayIndex int

The zero-based index in array at which copying begins.

Exceptions

ArgumentNullException

array is null.

ArgumentOutOfRangeException

arrayIndex is less than 0.

ArgumentException

The number of elements in the source ICollection<T> is greater than the available space from arrayIndex to the end of the destination array.

GetElement(string)

Gets the element associated with the given identifier.

public IMagnetElementBase GetElement(string identifier)

Parameters

identifier string

Returns

IMagnetElementBase

GetEnumerator()

Returns an enumerator that iterates through the collection.

public IEnumerator<IMagnetElement> GetEnumerator()

Returns

IEnumerator<IMagnetElement>

An enumerator that can be used to iterate through the collection.

IndexOf(IMagnetElement)

Determines the index of a specific item in the IList<T>.

public int IndexOf(IMagnetElement item)

Parameters

item IMagnetElement

The object to locate in the IList<T>.

Returns

int

The index of item if found in the list; otherwise, -1.

Insert(int, IMagnetElement)

Inserts an item to the IList<T> at the specified index.

public void Insert(int index, IMagnetElement item)

Parameters

index int

The zero-based index at which item should be inserted.

item IMagnetElement

The object to insert into the IList<T>.

Exceptions

ArgumentOutOfRangeException

index is not a valid index in the IList<T>.

NotSupportedException

The IList<T> is read-only.

Invalidate()

Invalidates the scene due to changed constraints.

public void Invalidate()

PrepareForArrange(double, double)

Arranges the elements on the stage based on the solved layout.

public void PrepareForArrange(double width, double height)

Parameters

width double
height double

PrepareForMeasure(double, double)

Applies the constraints and solves the layout.

public void PrepareForMeasure(double width, double height)

Parameters

width double
height double

Remove(IMagnetElement)

Removes the first occurrence of a specific object from the ICollection<T>.

public bool Remove(IMagnetElement item)

Parameters

item IMagnetElement

The object to remove from the ICollection<T>.

Returns

bool

true if item was successfully removed from the ICollection<T>; otherwise, false. This method also returns false if item is not found in the original ICollection<T>.

Exceptions

NotSupportedException

The ICollection<T> is read-only.

RemoveAt(int)

Removes the IList<T> item at the specified index.

public void RemoveAt(int index)

Parameters

index int

The zero-based index of the item to remove.

Exceptions

ArgumentOutOfRangeException

index is not a valid index in the IList<T>.

NotSupportedException

The IList<T> is read-only.

RemoveConstraint(Constraint)

Removes a constraint from the stage.

public void RemoveConstraint(Constraint constraint)

Parameters

constraint Constraint

RemoveEditVariable(Variable)

Removes an editable variable from the stage.

public void RemoveEditVariable(Variable variable)

Parameters

variable Variable

SuggestValue(Variable, double)

Suggests a value for the given editable variable based on the measured width and the size width.

public void SuggestValue(Variable variable, double value)

Parameters

variable Variable
value double

TryGetElement(string, out IMagnetElementBase?)

Tries to get the element associated with the given identifier.

public bool TryGetElement(string identifier, out IMagnetElementBase? element)

Parameters

identifier string
element IMagnetElementBase

Returns

bool