Skip to content

Class SAttribute

Definition

Namespace: StardewUI.Framework.Dom
Assembly: StardewUI.dll

Record implementation of a StarML IAttribute.

public record SAttribute : StardewUI.Framework.Dom.IAttribute, 
    IEquatable<StardewUI.Framework.Dom.SAttribute>

Inheritance
Object ⇦ SAttribute

Implements
IAttribute, IEquatable<SAttribute>

Remarks

Must be separate from the grammar's Attribute since ref structs currently are not allowed to implement interfaces.

Members

Constructors

Name Description
SAttribute(string, string, AttributeType, AttributeValueType, Boolean, ContextRedirect) Record implementation of a StarML IAttribute.
SAttribute(Attribute) Initializes a new SAttribute from the data of a parsed attribute.

Properties

Name Description
ContextRedirect Specifies the redirect to use for a context binding, if applicable and if the ValueType is one of the context binding types.
EqualityContract
IsNegated Whether the attribute has a negation. Validity and behavior depend on the specific attribute.
Name The attribute name.
Type The type of the attribute itself, defining how the Name should be interpreted.
Value The literal value text.
ValueType The type of the value expression, defining how the Value should be interpreted.

Methods

Name Description
AsArgument() Creates a method argument that will receive the same value as this attribute when bound.
WithNameAndType(string, AttributeType) Creates a copy of this attribute with a different Name and Type, and all other properties the same.

Details

Constructors

SAttribute(string, string, AttributeType, AttributeValueType, bool, ContextRedirect)

Record implementation of a StarML IAttribute.

public SAttribute(string Name, string Value, StardewUI.Framework.Grammar.AttributeType Type, StardewUI.Framework.Grammar.AttributeValueType ValueType, bool IsNegated, StardewUI.Framework.Dom.ContextRedirect ContextRedirect);
Parameters

Name   string
The attribute name.

Value   string
The literal value text.

Type   AttributeType
The type of the attribute itself, defining how the Name should be interpreted.

ValueType   AttributeValueType
The type of the value expression, defining how the Value should be interpreted.

IsNegated   Boolean
Whether the attribute has a negation. Validity and behavior depend on the specific attribute.

ContextRedirect   ContextRedirect
Specifies the redirect to use for a context binding, if applicable and if the ValueType is one of the context binding types.

Remarks

Must be separate from the grammar's Attribute since ref structs currently are not allowed to implement interfaces.


SAttribute(Attribute)

Initializes a new SAttribute from the data of a parsed attribute.

public SAttribute(StardewUI.Framework.Grammar.Attribute attribute);
Parameters

attribute   Attribute
The parsed attribute.


Properties

ContextRedirect

Specifies the redirect to use for a context binding, if applicable and if the ValueType is one of the context binding types.

public StardewUI.Framework.Dom.ContextRedirect ContextRedirect { get; set; }
Property Value

ContextRedirect


EqualityContract

protected System.Type EqualityContract { get; }
Property Value

Type


IsNegated

Whether the attribute has a negation. Validity and behavior depend on the specific attribute.

public bool IsNegated { get; set; }
Property Value

Boolean


Name

The attribute name.

public string Name { get; set; }
Property Value

string


Type

The type of the attribute itself, defining how the Name should be interpreted.

public StardewUI.Framework.Grammar.AttributeType Type { get; set; }
Property Value

AttributeType


Value

The literal value text.

public string Value { get; set; }
Property Value

string


ValueType

The type of the value expression, defining how the Value should be interpreted.

public StardewUI.Framework.Grammar.AttributeValueType ValueType { get; set; }
Property Value

AttributeValueType


Methods

AsArgument()

Creates a method argument that will receive the same value as this attribute when bound.

public StardewUI.Framework.Dom.SArgument AsArgument();
Returns

SArgument

The converted argument.


WithNameAndType(string, AttributeType)

Creates a copy of this attribute with a different Name and Type, and all other properties the same.

public StardewUI.Framework.Dom.SAttribute WithNameAndType(string name, StardewUI.Framework.Grammar.AttributeType type);
Parameters

name   string
The new attribute name.

type   AttributeType
The new attribute type.

Returns

SAttribute

The renamed attribute.