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