Class ChoiceList
A single-select list of lettered options.
Inheritance
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
[UxmlElement]
public class ChoiceList : RadioGroup, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder, IInputElement<string>, IValidatableElement<string>, INotifyValueChanged<string>
Remarks
ChoiceList is the multiple-choice question surface: a vertical list of full-width rows, each carrying an auto-assigned letter badge (A, B, C…), of which exactly one can be selected.
It derives from RadioGroup and its items from Radio, so the whole selection contract is the radio one and nothing about it is re-implemented: a value holding the selected key, mutual exclusivity, validateValue, change events and keyboard operation all come from the base types. ChoiceList adds only the lettering, and ChoiceListItem adds only the badge and the row presentation.
Letters are assigned in document order to the direct ChoiceListItem children and kept up to date as items attach or detach. Set letter explicitly to pin a badge, or to an empty string to hide it.
Examples
A lettered question.
<appui:ChoiceList value="balanced">
<appui:ChoiceListItem key="fast" label="Favor speed" />
<appui:ChoiceListItem key="balanced" label="Balanced" />
<appui:ChoiceListItem key="quality" label="Favor quality" />
</appui:ChoiceList>
Reading the answer.
var list = new ChoiceList();
list.Add(new ChoiceListItem { key = "fast", label = "Favor speed" });
list.Add(new ChoiceListItem { key = "quality", label = "Favor quality" });
list.RegisterValueChangedCallback(evt => Debug.Log($"Chose: {evt.newValue}"));
Constructors
ChoiceList()
Default constructor.
Declaration
public ChoiceList()
Fields
ussClassName
The ChoiceList main styling class.
Declaration
public const string ussClassName = "appui-choicelist"
Field Value
| Type | Description |
|---|---|
| string |