Class ScyllaChoiceCardGroup
A column of clickable cards, each with a title and a description, of which exactly one is selected. Used by wizards to choose between a few options that each need a sentence of explanation.
Implements
Inherited Members
Namespace: Scylla.Core.Editor
Assembly: ScyllaCore.Editor.dll
Syntax
public sealed class ScyllaChoiceCardGroup : VisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, ICustomStyle
Remarks
Add options with AddOption(string, string, string), each with an ID, then select one with SetSelectedWithoutNotify(string). Clicking a card selects it and raises SelectionChanged with its ID. A disabled card cannot be selected and can carry a reason in its tooltip.
Properties
IsHorizontal
Gets or sets whether the cards sit side by side in one row, sharing its width equally, instead of in a column. Suits two or three options with short descriptions.
Declaration
public bool IsHorizontal { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
SelectedID
Gets the ID of the selected option, or null when none is selected.
Declaration
public string SelectedID { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
AddOption(string, string, string)
Adds a card for an option.
Declaration
public void AddOption(string id, string title, string description)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | The option's ID, reported by SelectionChanged. Must be unique in the group. |
| string | title | The card's title. |
| string | description | The sentence under the title, or null for none. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when the ID is empty or already used. |
SetOptionEnabled(string, bool, string)
Enables or disables an option's card. A disabled card cannot be clicked.
Declaration
public void SetOptionEnabled(string id, bool enabled, string reason = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | The option ID. |
| bool | enabled | Whether the card can be selected. |
| string | reason | Tooltip explaining why the card is disabled, or null. |
SetSelectedWithoutNotify(string)
Selects an option without raising SelectionChanged.
Declaration
public void SetSelectedWithoutNotify(string id)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | The option ID, or null to select nothing. |
Events
SelectionChanged
Raised with the option ID when the user clicks a card that was not selected. Not raised by SetSelectedWithoutNotify(string).
Declaration
public event Action<string> SelectionChanged
Event Type
| Type | Description |
|---|---|
| Action<string> |