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
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
Id
Gets the unique identifier for this element.
public string Id { get; }
Property Value
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
indexintThe zero-based index of the element to get or set.
Property Value
- IMagnetElement
The element at the specified index.
Exceptions
- ArgumentOutOfRangeException
indexis 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
Right
End pole of the element.
public Variable Right { get; }
Property Value
Top
Top pole of the element.
public Variable Top { get; }
Property Value
WidthRequest
The requested stage width.
public double WidthRequest { get; }
Property Value
Methods
Add(IMagnetElement)
Adds an item to the ICollection<T>.
public void Add(IMagnetElement item)
Parameters
itemIMagnetElementThe 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
constraintConstraint
AddEditVariable(Variable, double)
Adds an editable variable to the stage.
public void AddEditVariable(Variable variable, double strength)
Parameters
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
itemIMagnetElementThe object to locate in the ICollection<T>.
Returns
- bool
true if
itemis 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
arrayIMagnetElement[]The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.
arrayIndexintThe zero-based index in
arrayat which copying begins.
Exceptions
- ArgumentNullException
arrayis null.- ArgumentOutOfRangeException
arrayIndexis less than 0.- ArgumentException
The number of elements in the source ICollection<T> is greater than the available space from
arrayIndexto the end of the destinationarray.
GetElement(string)
Gets the element associated with the given identifier.
public IMagnetElementBase GetElement(string identifier)
Parameters
identifierstring
Returns
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
itemIMagnetElementThe object to locate in the IList<T>.
Returns
- int
The index of
itemif 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
indexintThe zero-based index at which
itemshould be inserted.itemIMagnetElementThe object to insert into the IList<T>.
Exceptions
- ArgumentOutOfRangeException
indexis 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
PrepareForMeasure(double, double)
Applies the constraints and solves the layout.
public void PrepareForMeasure(double width, double height)
Parameters
Remove(IMagnetElement)
Removes the first occurrence of a specific object from the ICollection<T>.
public bool Remove(IMagnetElement item)
Parameters
itemIMagnetElementThe object to remove from the ICollection<T>.
Returns
- bool
true if
itemwas successfully removed from the ICollection<T>; otherwise, false. This method also returns false ifitemis 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
indexintThe zero-based index of the item to remove.
Exceptions
- ArgumentOutOfRangeException
indexis 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
constraintConstraint
RemoveEditVariable(Variable)
Removes an editable variable from the stage.
public void RemoveEditVariable(Variable variable)
Parameters
variableVariable
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
TryGetElement(string, out IMagnetElementBase?)
Tries to get the element associated with the given identifier.
public bool TryGetElement(string identifier, out IMagnetElementBase? element)
Parameters
identifierstringelementIMagnetElementBase