Class Picker<TItem, TTitle>
A Picker UI element with a title and a list of items.
Inheritance
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
public abstract class Picker<TItem, TTitle> : Picker, IEventHandler, IVisualElementScheduler, IExperimentalFeatures, ITransitionAnimations, ITransform, IResolvedStyle, IContextOverrideElement, IAdditionalDataHolder, IInputElement<IEnumerable<int>>, IValidatableElement<IEnumerable<int>>, INotifyValueChanged<IEnumerable<int>>, ISizeableElement, IPressable where TItem : BaseVisualElement, new() where TTitle : BaseVisualElement, new()
Type Parameters
Name | Description |
---|---|
TItem | The type of the items contained in the Picker. |
TTitle | The type of the title contained in the Picker. |
Constructors
Picker(IList, Func<TItem>, Func<TTitle>, BindItemFunc, BindTitleFunc, BindItemFunc, int[])
Default constructor.
Declaration
public Picker(IList items, Func<TItem> makeItemFunc = null, Func<TTitle> makeTitleFunc = null, Picker<TItem, TTitle>.BindItemFunc bindItemFunc = null, Picker<TItem, TTitle>.BindTitleFunc bindTitleFunc = null, Picker<TItem, TTitle>.BindItemFunc unbindItemFunc = null, int[] defaultIndices = null)
Parameters
Type | Name | Description |
---|---|---|
IList | items | The items collection. |
Func<TItem> | makeItemFunc | The function used to create a Picker item. |
Func<TTitle> | makeTitleFunc | The function used to create a Picker title. |
Picker<TItem, TTitle>.Bind |
bindItemFunc | The function used to bind a Picker item. |
Picker<TItem, TTitle>.Bind |
bindTitleFunc | The function used to bind a Picker title. |
Picker<TItem, TTitle>.Bind |
unbindItemFunc | The function used to unbind a Picker item. |
int[] | defaultIndices | The selected index by default. |
Properties
bindItem
The function used to bind a Picker item.
Declaration
public Picker<TItem, TTitle>.BindItemFunc bindItem { get; set; }
Property Value
Type | Description |
---|---|
Picker<TItem, TTitle>.Bind |
bindTitle
The function used to bind a Picker title.
Declaration
public Picker<TItem, TTitle>.BindTitleFunc bindTitle { get; set; }
Property Value
Type | Description |
---|---|
Picker<TItem, TTitle>.Bind |
makeItem
The function used to create a Picker item.
Declaration
public Func<TItem> makeItem { get; set; }
Property Value
Type | Description |
---|---|
Func<TItem> |
makeTitle
The function used to create a Picker title.
Declaration
public Func<TTitle> makeTitle { get; set; }
Property Value
Type | Description |
---|---|
Func<TTitle> |
unbindItem
The function used to unbind a Picker item.
Declaration
public Picker<TItem, TTitle>.BindItemFunc unbindItem { get; set; }
Property Value
Type | Description |
---|---|
Picker<TItem, TTitle>.Bind |
Methods
GetPickerItem(int)
Get the Picker item at the given index.
Declaration
protected TItem GetPickerItem(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the item to get. |
Returns
Type | Description |
---|---|
TItem | The Picker item at the given index. |
OnRequestItemCreation(int)
Create a Picker item.
Declaration
protected override VisualElement OnRequestItemCreation(int i)
Parameters
Type | Name | Description |
---|---|---|
int | i | The index of the item to create. |
Returns
Type | Description |
---|---|
Visual |
The created item. |
Overrides
OnUnbindItem(VisualElement, int)
Unbind a Picker item.
Declaration
protected override void OnUnbindItem(VisualElement item, int index)
Parameters
Type | Name | Description |
---|---|---|
Visual |
item | The item to unbind. |
int | index | The index of the item to unbind. |
Overrides
RefreshTitleUI()
Refresh the Picker title UI.
Declaration
protected override void RefreshTitleUI()