Skip to content

Class OutletAttribute

Definition

Namespace: StardewUI.Widgets
Assembly: StardewUI.dll

Marks a child/children property as a named outlet.

[System.AttributeUsage]
public class OutletAttribute : System.Attribute

Inheritance
ObjectAttribute ⇦ OutletAttribute

Remarks

Outlets are used by the UI Framework, in StarML views, to differentiate between multiple child properties of the same layout view. For example, the Expander defines both a Content view (the "main" view) and a separate Header view, but normally only one children/content property is allowed per layout view.

When a property is decorated with an OutletAttribute, it is ignored by the framework unless the markup element includes an *outlet attribute with a value equal to the outlet Name, in which case the element (or elements) will be added or assigned to that specific outlet.

The attribute should be omitted for whichever outlet is considered the default, i.e. to be targeted whenever the markup element does not include an *outlet attribute.

Has no effect when used outside a data binding context, or when applied to any property that does not have either IView or a collection of IView elements such as IEnumerable<T>.

Members

Constructors

Name Description
OutletAttribute(string) Marks a child/children property as a named outlet.

Properties

Name Description
Name The outlet name, to be matched in an *outlet attribute.
TypeId (Inherited from Attribute)

Methods

Name Description
Equals(Object) (Inherited from Attribute)
GetHashCode() (Inherited from Attribute)
IsDefaultAttribute() (Inherited from Attribute)
Match(Object) (Inherited from Attribute)

Details

Constructors

OutletAttribute(string)

Marks a child/children property as a named outlet.

public OutletAttribute(string name);
Parameters

name   string
The outlet name, to be matched in an *outlet attribute.

Remarks

Outlets are used by the UI Framework, in StarML views, to differentiate between multiple child properties of the same layout view. For example, the Expander defines both a Content view (the "main" view) and a separate Header view, but normally only one children/content property is allowed per layout view.

When a property is decorated with an OutletAttribute, it is ignored by the framework unless the markup element includes an *outlet attribute with a value equal to the outlet Name, in which case the element (or elements) will be added or assigned to that specific outlet.

The attribute should be omitted for whichever outlet is considered the default, i.e. to be targeted whenever the markup element does not include an *outlet attribute.

Has no effect when used outside a data binding context, or when applied to any property that does not have either IView or a collection of IView elements such as IEnumerable<T>.


Properties

Name

The outlet name, to be matched in an *outlet attribute.

public string Name { get; }
Property Value

string