docs.unity3d.com
    Show / Hide Table of Contents

    Class Dropdown

    VisualElement to choose an item among a defined list of choices.

    Inheritance
    Object
    Dropdown
    Namespace: Unity.Industrial.Forma.StandardUI
    Syntax
    public class Dropdown : VisualElement, INotifyValueChanged<int>

    Constructors

    Dropdown()

    Declaration
    public Dropdown()

    Dropdown(String, IList)

    Instantiate a new Dropdown visual element. The given list of choices needs to be an .

    Declaration
    public Dropdown(string label, IList choices = null)
    Parameters
    Type Name Description
    String label

    The given label string value, if any.

    IList choices

    The list of choices.

    Properties

    contentContainer

    Declaration
    public override VisualElement contentContainer { get; }
    Property Value
    Type Description
    VisualElement

    itemsSource

    Get or Set the choices list.

    Declaration
    public IList itemsSource { get; set; }
    Property Value
    Type Description
    IList

    label

    Get or Set the label string value. If the value is null or empty, a "no-label" class will be applied in USS.

    Declaration
    public string label { get; set; }
    Property Value
    Type Description
    String

    selectedItem

    Returns the selected value stored into the selected visual item. If no valid selection was made, the property returns NULL.

    Declaration
    public object selectedItem { get; set; }
    Property Value
    Type Description
    Object

    value

    Get or Set the currently selected index. If the given value is out of range, a warning will be prompted in the Logger. If this property returns a negative number, there's no selection made from the choices list.

    Declaration
    public int value { get; set; }
    Property Value
    Type Description
    Int32

    Methods

    FromEnum<T>(String)

    Special constructor to instantiate a Dropdown from an type. C# uses with the parameter "G" by default when calling on values, which returns the name of the value as string.

    Declaration
    public static Dropdown FromEnum<T>(string label = null)
        where T : Enum
    Parameters
    Type Name Description
    String label

    The label string value, if any.

    Returns
    Type Description
    Dropdown

    An instance of the Dropdown class.

    Type Parameters
    Name Description
    T

    The type.

    Refresh()

    Declaration
    public void Refresh()

    SetValueWithoutNotify(Int32)

    Declaration
    public void SetValueWithoutNotify(int newSelectedIndex)
    Parameters
    Type Name Description
    Int32 newSelectedIndex
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023