Class DropdownField
A control that allows the user to pick a choice from a list of options.
Inheritance
DropdownField
Inherited Members
Namespace: UnityEngine.UIElements
Syntax
public class DropdownField : BaseField<string>, IEventHandler, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IResolvedStyle, IBindable, INotifyValueChanged<string>, IMixedValueSupport
Constructors
DropdownField()
Construct a DropdownField.
Declaration
public DropdownField()
DropdownField(List<String>, Int32, Func<String, String>, Func<String, String>)
Construct a DropdownField.
Declaration
public DropdownField(List<string> choices, int defaultIndex, Func<string, string> formatSelectedValueCallback = null, Func<string, string> formatListItemCallback = null)
Parameters
Type | Name | Description |
---|---|---|
List<String> | choices | |
Int32 | defaultIndex | |
Func<String, String> | formatSelectedValueCallback | |
Func<String, String> | formatListItemCallback |
DropdownField(List<String>, String, Func<String, String>, Func<String, String>)
Construct a DropdownField.
Declaration
public DropdownField(List<string> choices, string defaultValue, Func<string, string> formatSelectedValueCallback = null, Func<string, string> formatListItemCallback = null)
Parameters
Type | Name | Description |
---|---|---|
List<String> | choices | |
String | defaultValue | |
Func<String, String> | formatSelectedValueCallback | |
Func<String, String> | formatListItemCallback |
DropdownField(String)
Construct a DropdownField.
Declaration
public DropdownField(string label)
Parameters
Type | Name | Description |
---|---|---|
String | label |
DropdownField(String, List<String>, Int32, Func<String, String>, Func<String, String>)
Construct a DropdownField.
Declaration
public DropdownField(string label, List<string> choices, int defaultIndex, Func<string, string> formatSelectedValueCallback = null, Func<string, string> formatListItemCallback = null)
Parameters
Type | Name | Description |
---|---|---|
String | label | |
List<String> | choices | |
Int32 | defaultIndex | |
Func<String, String> | formatSelectedValueCallback | |
Func<String, String> | formatListItemCallback |
DropdownField(String, List<String>, String, Func<String, String>, Func<String, String>)
Construct a DropdownField.
Declaration
public DropdownField(string label, List<string> choices, string defaultValue, Func<string, string> formatSelectedValueCallback = null, Func<string, string> formatListItemCallback = null)
Parameters
Type | Name | Description |
---|---|---|
String | label | |
List<String> | choices | |
String | defaultValue | |
Func<String, String> | formatSelectedValueCallback | |
Func<String, String> | formatListItemCallback |
Properties
choices
The list of choices to display in the popup menu.
Declaration
public virtual List<string> choices { get; set; }
Property Value
Type | Description |
---|---|
List<String> |
index
The currently selected index in the popup menu.
Declaration
public int index { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
text
This is the text displayed to the user for the current selection of the popup.
Declaration
public string text { get; }
Property Value
Type | Description |
---|---|
String |
textElement
This is the text displayed.
Declaration
protected TextElement textElement { get; }
Property Value
Type | Description |
---|---|
TextElement |
value
The currently selected value in the popup menu.
Declaration
public override string value { get; set; }
Property Value
Type | Description |
---|---|
String |
Overrides
UnityEngine.UIElements.BaseField<System.String>.value
Methods
ExecuteDefaultActionAtTarget(EventBase)
Declaration
protected override void ExecuteDefaultActionAtTarget(EventBase evt)
Parameters
Type | Name | Description |
---|---|---|
EventBase | evt |
Overrides
SetValueWithoutNotify(String)
Allow changing value without triggering any change event.
Declaration
public override void SetValueWithoutNotify(string newValue)
Parameters
Type | Name | Description |
---|---|---|
String | newValue | The new value. |
Overrides
UnityEngine.UIElements.BaseField<System.String>.SetValueWithoutNotify(System.String)
UpdateMixedValueContent()
Declaration
protected override void UpdateMixedValueContent()
Overrides
UnityEngine.UIElements.BaseField<System.String>.UpdateMixedValueContent()