MultiSelectionPrompt<T> Class
Represents a multi selection list prompt.
public sealed class MultiSelectionPrompt<T> : IPrompt<List<T>>, IListPromptStrategy<T>
where T : notnull
- Namespace
- Spectre
.Console
Parameters
-
T
- The prompt result type.
Constructors
-
MultiSelectionPrompt
(IEqualityComparer <T> ) -
Initializes a new instance of the
MultiSelectionPrompt<T>
class.
Properties
- Func<T, string> Converter
-
Gets or sets the converter to get the display string for a choice. By default
the corresponding
TypeConverter
is used. - Style HighlightStyle
- Gets or sets the highlight style of the selected choice.
- string InstructionsText
- Gets or sets the text that instructs the user of how to select items.
- string MoreChoicesText
- Gets or sets the text that will be displayed if there are more choices to show.
- int PageSize
-
Gets or sets the page size.
Defaults to
10
. - bool Required
- Gets or sets a value indicating whether or not at least one selection is required.
- string Title
- Gets or sets the title.
- bool WrapAround
-
Gets or sets a value indicating whether the selection should wrap around when reaching the edge.
Defaults to
false
.
Methods
-
IMultiSelectionItem<T> AddChoice
(T) - Adds a choice.
-
T GetParent
(T) - Returns the parent item of the given item.
-
IEnumerable<T> GetParents
(T) - Returns all parent items of the given item.
-
List<T> Show
(IAnsiConsole) - Shows the prompt.
-
Task<List<T>> ShowAsync
(IAnsiConsole, CancellationToken) - Shows the prompt asynchronously.
Extension Methods
-
MultiSelectionPrompt<T> AddChoiceGroup
<T> (T, IEnumerable <T> ) - Adds multiple grouped choices.
-
MultiSelectionPrompt<T> AddChoiceGroup
<T> (T, T[]) - Adds multiple grouped choices.
-
MultiSelectionPrompt<T> AddChoices
<T> (IEnumerable <T> ) - Adds multiple choices.
-
MultiSelectionPrompt<T> AddChoices
<T> (T, Action < I Multi Selection Item <T> > ) - Adds a choice.
-
MultiSelectionPrompt<T> AddChoices
<T> (T[]) - Adds multiple choices.
-
MultiSelectionPrompt<T> HighlightStyle
<T> (Style) - Sets the highlight style of the selected choice.
-
MultiSelectionPrompt<T> InstructionsText
<T> (string) - Sets the text that instructs the user of how to select items.
-
MultiSelectionPrompt<T> Mode
<T> (SelectionMode) - Sets the selection mode.
-
MultiSelectionPrompt<T> MoreChoicesText
<T> (string) - Sets the text that will be displayed if there are more choices to show.
-
MultiSelectionPrompt<T> NotRequired
<T> () - Requires no choice to be selected.
-
MultiSelectionPrompt<T> PageSize
<T> (int) - Sets how many choices that are displayed to the user.
-
MultiSelectionPrompt<T> Required
<T> (bool) - Sets a value indicating whether or not at least one choice must be selected.
-
MultiSelectionPrompt<T> Required
<T> () - Requires a choice to be selected.
-
MultiSelectionPrompt<T> Select
<T> (T) - Marks an item as selected.
-
MultiSelectionPrompt<T> Title
<T> (string) - Sets the title.
-
MultiSelectionPrompt<T> UseConverter
<T> (Func <T, string> ) - Sets the function to create a display string for a given choice.
-
MultiSelectionPrompt<T> WrapAround
<T> (bool) - Sets whether the selection should wrap around when reaching its edges.