Class Picker
Picker UI element.
Inheritance
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: solution.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 static readonly string appuiPickerMenu
Field Value
Type | Description |
---|---|
string |
caretUssClassName
The Picker caret styling class.
Declaration
public static readonly string caretUssClassName
Field Value
Type | Description |
---|---|
string |
emphasizedUssClassName
The Picker emphasized mode styling class.
Declaration
public static readonly string emphasizedUssClassName
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 static readonly string sizeUssClassName
Field Value
Type | Description |
---|---|
string |
titleContainerUssClassName
The Picker title container styling class.
Declaration
public static readonly string titleContainerUssClassName
Field Value
Type | Description |
---|---|
string |
titleUssClassName
The Picker title styling class.
Declaration
public static readonly string titleUssClassName
Field Value
Type | Description |
---|---|
string |
trailingContainerUssClassName
The Picker trailing container styling class.
Declaration
public static readonly string trailingContainerUssClassName
Field Value
Type | Description |
---|---|
string |
ussClassName
The Picker main styling class.
Declaration
public static readonly string ussClassName
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
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. |