docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class Picker

    Picker UI element.

    Inheritance
    object
    CallbackEventHandler
    Focusable
    VisualElement
    BaseVisualElement
    ExVisualElement
    Picker
    Picker<TItemType, TTitleType>
    Implements
    IEventHandler
    ITransform
    ITransitionAnimations
    IExperimentalFeatures
    IVisualElementScheduler
    IResolvedStyle
    IContextOverrideElement
    IInputElement<IEnumerable<int>>
    IValidatableElement<IEnumerable<int>>
    INotifyValueChanged<IEnumerable<int>>
    ISizeableElement
    IPressable
    Inherited Members
    ExVisualElement.contentContainer
    ExVisualElement.outlineColor
    ExVisualElement.backgroundColor
    ExVisualElement.passMask
    BaseVisualElement.contextPrefix
    BaseVisualElement.scaleOverride
    BaseVisualElement.themeOverride
    BaseVisualElement.langOverride
    BaseVisualElement.layoutDirectionOverride
    BaseVisualElement.preferredTooltipPlacementOverride
    BaseVisualElement.tooltipDelayMsOverride
    BaseVisualElement.GetLayoutDirectionUssClassName(Dir)
    VisualElement.disabledUssClassName
    VisualElement.ExecuteDefaultAction(EventBase)
    VisualElement.Focus()
    VisualElement.SendEvent(EventBase)
    VisualElement.SetEnabledFromHierarchy(bool)
    VisualElement.SetEnabled(bool)
    VisualElement.MarkDirtyRepaint()
    VisualElement.ContainsPoint(Vector2)
    VisualElement.Overlaps(Rect)
    VisualElement.DoMeasure(float, VisualElement.MeasureMode, float, VisualElement.MeasureMode)
    VisualElement.ToString()
    VisualElement.GetClasses()
    VisualElement.ClearClassList()
    VisualElement.AddToClassList(string)
    VisualElement.RemoveFromClassList(string)
    VisualElement.ToggleInClassList(string)
    VisualElement.EnableInClassList(string, bool)
    VisualElement.ClassListContains(string)
    VisualElement.FindAncestorUserData()
    VisualElement.Add(VisualElement)
    VisualElement.Insert(int, VisualElement)
    VisualElement.Remove(VisualElement)
    VisualElement.RemoveAt(int)
    VisualElement.Clear()
    VisualElement.ElementAt(int)
    VisualElement.IndexOf(VisualElement)
    VisualElement.Children()
    VisualElement.Sort(Comparison<VisualElement>)
    VisualElement.BringToFront()
    VisualElement.SendToBack()
    VisualElement.PlaceBehind(VisualElement)
    VisualElement.PlaceInFront(VisualElement)
    VisualElement.RemoveFromHierarchy()
    VisualElement.GetFirstOfType<T>()
    VisualElement.GetFirstAncestorOfType<T>()
    VisualElement.Contains(VisualElement)
    VisualElement.FindCommonAncestor(VisualElement)
    VisualElement.viewDataKey
    VisualElement.userData
    VisualElement.canGrabFocus
    VisualElement.focusController
    VisualElement.usageHints
    VisualElement.transform
    VisualElement.layout
    VisualElement.contentRect
    VisualElement.paddingRect
    VisualElement.worldBound
    VisualElement.localBound
    VisualElement.worldTransform
    VisualElement.pickingMode
    VisualElement.name
    VisualElement.enabledInHierarchy
    VisualElement.enabledSelf
    VisualElement.visible
    VisualElement.generateVisualContent
    VisualElement.experimental
    VisualElement.hierarchy
    VisualElement.cacheAsBitmap
    VisualElement.parent
    VisualElement.panel
    VisualElement.visualTreeAssetSource
    VisualElement.this[int]
    VisualElement.childCount
    VisualElement.schedule
    VisualElement.style
    VisualElement.customStyle
    VisualElement.styleSheets
    VisualElement.tooltip
    VisualElement.resolvedStyle
    Focusable.Blur()
    Focusable.focusable
    Focusable.tabIndex
    Focusable.delegatesFocus
    CallbackEventHandler.RegisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.RegisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TUserArgsType, TrickleDown)
    CallbackEventHandler.UnregisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.UnregisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TrickleDown)
    CallbackEventHandler.HandleEvent(EventBase)
    CallbackEventHandler.HasTrickleDownHandlers()
    CallbackEventHandler.HasBubbleUpHandlers()
    CallbackEventHandler.ExecuteDefaultActionAtTarget(EventBase)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Unity.AppUI.UI
    Assembly: Unity.AppUI.dll
    Syntax
    public abstract class Picker : ExVisualElement, IEventHandler, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IResolvedStyle, IContextOverrideElement, IInputElement<IEnumerable<int>>, IValidatableElement<IEnumerable<int>>, INotifyValueChanged<IEnumerable<int>>, ISizeableElement, IPressable

    Constructors

    Picker()

    Default constructor.

    Declaration
    public Picker()

    Picker(IList, int[])

    Construct a Picker UI element with a provided dynamic collection of items.

    Declaration
    public Picker(IList items, int[] defaultIndices = null)
    Parameters
    Type Name Description
    IList items

    An items collection.

    int[] defaultIndices

    The selected index by default.

    Fields

    appuiPickerMenu

    The Picker menu styling class.

    Declaration
    public const string appuiPickerMenu = "appui-picker__menu"
    Field Value
    Type Description
    string

    caretUssClassName

    The Picker caret styling class.

    Declaration
    public const string caretUssClassName = "appui-picker__caret"
    Field Value
    Type Description
    string

    emphasizedUssClassName

    The Picker emphasized mode styling class.

    Declaration
    public const string emphasizedUssClassName = "appui-picker--emphasized"
    Field Value
    Type Description
    string

    m_Items

    The list of items contained in the Picker.

    Declaration
    protected readonly List<PickerItem> m_Items
    Field Value
    Type Description
    List<PickerItem>

    m_TitleContainer

    The container for the Picker title.

    Declaration
    protected readonly VisualElement m_TitleContainer
    Field Value
    Type Description
    VisualElement

    m_Value

    The list of indices of the selected items.

    Declaration
    protected readonly List<int> m_Value
    Field Value
    Type Description
    List<int>

    sizeUssClassName

    The Picker size styling class.

    Declaration
    public const string sizeUssClassName = "appui-picker--size-"
    Field Value
    Type Description
    string

    titleContainerUssClassName

    The Picker title container styling class.

    Declaration
    public const string titleContainerUssClassName = "appui-picker__titlecontainer"
    Field Value
    Type Description
    string

    titleUssClassName

    The Picker title styling class.

    Declaration
    public const string titleUssClassName = "appui-picker__title"
    Field Value
    Type Description
    string

    trailingContainerUssClassName

    The Picker trailing container styling class.

    Declaration
    public const string trailingContainerUssClassName = "appui-picker__trailingcontainer"
    Field Value
    Type Description
    string

    ussClassName

    The Picker main styling class.

    Declaration
    public const string ussClassName = "appui-picker"
    Field Value
    Type Description
    string

    Properties

    clickable

    Clickable Manipulator for this Picker.

    Declaration
    public Pressable clickable { get; set; }
    Property Value
    Type Description
    Pressable

    closeOnSelection

    Close the picker menu automatically when an item is selected.

    Declaration
    public bool closeOnSelection { get; set; }
    Property Value
    Type Description
    bool

    defaultMessage

    The Picker default message when no item is selected.

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

    defaultValue

    The Picker default value. This is the value that will be selected if no value is set.

    Declaration
    public int[] defaultValue { get; set; }
    Property Value
    Type Description
    int[]

    emphasized

    The Picker emphasized mode.

    Declaration
    public bool emphasized { get; set; }
    Property Value
    Type Description
    bool

    invalid

    The Picker invalid state.

    Declaration
    public bool invalid { get; set; }
    Property Value
    Type Description
    bool

    selectedIndex

    Quick access to the currently selected index for a Picker in Single selection mode.

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

    selectionType

    The Picker selection type.

    Declaration
    public PickerSelectionType selectionType { get; set; }
    Property Value
    Type Description
    PickerSelectionType
    Remarks

    If the selection type is changed, the Picker value will be reset.

    size

    The Picker size.

    Declaration
    public Size size { get; set; }
    Property Value
    Type Description
    Size

    sourceItems

    The source items collection.

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

    validateValue

    The Picker validation function.

    Declaration
    public Func<IEnumerable<int>, bool> validateValue { get; set; }
    Property Value
    Type Description
    Func<IEnumerable<int>, bool>

    value

    The Picker value. This is the index of the selected item.

    Declaration
    public IEnumerable<int> value { get; set; }
    Property Value
    Type Description
    IEnumerable<int>

    Methods

    GetSizeUssClassName(Size)

    Declaration
    public static string GetSizeUssClassName(Size enumValue)
    Parameters
    Type Name Description
    Size enumValue
    Returns
    Type Description
    string

    OnRequestItemCreation(int)

    Create a Picker item.

    Declaration
    protected abstract VisualElement OnRequestItemCreation(int i)
    Parameters
    Type Name Description
    int i

    The index of the item to create.

    Returns
    Type Description
    VisualElement

    The created item.

    OnUnbindItem(VisualElement, int)

    Unbind a Picker item.

    Declaration
    protected abstract void OnUnbindItem(VisualElement item, int index)
    Parameters
    Type Name Description
    VisualElement item

    The item to unbind.

    int index

    The index of the item to unbind.

    Refresh()

    Refresh the Picker UI.

    Declaration
    public void Refresh()

    RefreshListUI()

    Refresh the Picker list UI.

    Declaration
    protected void RefreshListUI()

    RefreshTitleUI()

    Refresh the Picker title UI.

    Declaration
    protected abstract void RefreshTitleUI()

    RefreshUI()

    Refresh the Picker UI.

    Declaration
    protected void RefreshUI()

    SetValueWithoutNotify(IEnumerable<int>)

    Set the Picker value without notifying any listeners.

    Declaration
    public void SetValueWithoutNotify(IEnumerable<int> newValue)
    Parameters
    Type Name Description
    IEnumerable<int> newValue

    The new value to set.

    Implements

    IEventHandler
    ITransform
    ITransitionAnimations
    IExperimentalFeatures
    IVisualElementScheduler
    IResolvedStyle
    IContextOverrideElement
    IInputElement<TValueType>
    IValidatableElement<TValueType>
    INotifyValueChanged<T>
    ISizeableElement
    IPressable

    Extension Methods

    VisualElementExtensions.FindNavController(VisualElement)
    VisualElementExtensions.GetChildren<T>(VisualElement, bool)
    VisualElementExtensions.GetContextProvider<T>(VisualElement)
    VisualElementExtensions.GetContext<T>(VisualElement)
    VisualElementExtensions.GetPreferredTooltipPlacement(VisualElement)
    VisualElementExtensions.GetSelfContext<T>(VisualElement)
    VisualElementExtensions.GetTooltipTemplate(VisualElement)
    VisualElementExtensions.IsContextProvider<T>(VisualElement)
    VisualElementExtensions.ProvideContext<T>(VisualElement, T)
    VisualElementExtensions.RegisterContextChangedCallback<T>(VisualElement, EventCallback<ContextChangedEvent<T>>)
    VisualElementExtensions.SetPreferredTooltipPlacement(VisualElement, OptionalEnum<PopoverPlacement>)
    VisualElementExtensions.SetTooltipTemplate(VisualElement, VisualElement)
    VisualElementExtensions.UnregisterContextChangedCallback<T>(VisualElement, EventCallback<ContextChangedEvent<T>>)
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)