Class EnumField
EnumField UI element.
Inheritance
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
public class EnumField : Dropdown, IEventHandler, IVisualElementScheduler, IExperimentalFeatures, ITransitionAnimations, ITransform, IResolvedStyle, IContextOverrideElement, IAdditionalDataHolder, IInputElement<IEnumerable<int>>, IValidatableElement<IEnumerable<int>>, INotifyValueChanged<IEnumerable<int>>, ISizeableElement, IPressable, IInputElement<Enum>, IValidatableElement<Enum>, INotifyValueChanged<Enum>
Constructors
EnumField()
Default constructor.
Declaration
public EnumField()
Remarks
You should use the constructor with the defaultEnumValue parameter to ensure the field is properly initialized.
EnumField(Enum, BindItemFunc, BindTitleFunc)
Constructor with a default enum value.
Declaration
public EnumField(Enum defaultEnumValue = null, Picker<DropdownItem, DropdownItem>.BindItemFunc bindItemFunc = null, Picker<DropdownItem, DropdownItem>.BindTitleFunc bindTitleFunc = null)
Parameters
Type | Name | Description |
---|---|---|
Enum | defaultEnumValue | The default value for the field. |
Picker<Dropdown |
bindItemFunc | An optional function to bind the item. |
Picker<Dropdown |
bindTitleFunc | An optional function to bind the title. |
Fields
ussClassName
The main styling class for the EnumField.
Declaration
public const string ussClassName = "appui-enum-field"
Field Value
Type | Description |
---|---|
string |
Properties
enumType
The type of the enum.
Declaration
public Type enumType { get; set; }
Property Value
Type | Description |
---|---|
Type |
validateValue
An optional function to validate the value.
Declaration
public Func<Enum, bool> validateValue { get; set; }
Property Value
value
The current value of the field.
Declaration
public Enum value { get; set; }
Property Value
Type | Description |
---|---|
Enum |
Methods
OnValueSet()
Called when the Picker value is set with or without notifying listeners.
Declaration
protected override void OnValueSet()
Overrides
SetValueWithoutNotify(Enum)
Set the value of the field without notifying the change.
Declaration
public void SetValueWithoutNotify(Enum newValue)
Parameters
Type | Name | Description |
---|---|---|
Enum | newValue | The new value to set. |