SelectionPromptExtensions
Namespace: Hex1b
Assembly: Hex1b.dll
Extension methods for building .
public static class SelectionPromptExtensionsInheritance
Object → SelectionPromptExtensions
Methods
EmptyMessage<T>(SelectionPromptWidget<T>, string)
Sets the message shown when the filter excludes every item. Defaults to "No matches.".
Parameters:
widget(SelectionPromptWidget<<T>>):text(String):
Returns: SelectionPromptWidget<<T>>
public static SelectionPromptWidget<T> EmptyMessage<T>(this SelectionPromptWidget<T> widget, string text)FilterText<T>(SelectionPromptWidget<T>, Func<T, string>)
Overrides the string projection used for filter matching and Right-Arrow prediction. When unset, the selector is used for both display and filtering; setting this lets you display rich rows (e.g. name + description) while filtering only on a salient subset (e.g. name).
Parameters:
widget(SelectionPromptWidget<<T>>):selector(Func<<T>, String>):
Returns: SelectionPromptWidget<<T>>
public static SelectionPromptWidget<T> FilterText<T>(this SelectionPromptWidget<T> widget, Func<T, string> selector)ItemText<T>(SelectionPromptWidget<T>, Func<T, string>)
Sets the string projection used both for filtering (case-insensitive substring match) and for default row rendering. Defaults to .
Parameters:
widget(SelectionPromptWidget<<T>>):selector(Func<<T>, String>):
Returns: SelectionPromptWidget<<T>>
public static SelectionPromptWidget<T> ItemText<T>(this SelectionPromptWidget<T> widget, Func<T, string> selector)MaxVisibleItems<T>(SelectionPromptWidget<T>, int)
Sets the maximum number of list rows shown at once. The list scrolls within this window. Defaults to 8.
Parameters:
widget(SelectionPromptWidget<<T>>):rows(Int32):
Returns: SelectionPromptWidget<<T>>
public static SelectionPromptWidget<T> MaxVisibleItems<T>(this SelectionPromptWidget<T> widget, int rows)OnSelected<T>(SelectionPromptWidget<T>, Action<T>)
Sets a synchronous handler invoked when the user presses Enter on a filtered item.
Parameters:
widget(SelectionPromptWidget<<T>>):handler(Action<<T>>):
Returns: SelectionPromptWidget<<T>>
public static SelectionPromptWidget<T> OnSelected<T>(this SelectionPromptWidget<T> widget, Action<T> handler)OnSelected<T>(SelectionPromptWidget<T>, Func<T, Task>)
Sets an asynchronous handler invoked when the user presses Enter on a filtered item.
Parameters:
widget(SelectionPromptWidget<<T>>):handler(Func<<T>, Task>):
Returns: SelectionPromptWidget<<T>>
public static SelectionPromptWidget<T> OnSelected<T>(this SelectionPromptWidget<T> widget, Func<T, Task> handler)Prompt<T>(SelectionPromptWidget<T>, string)
Sets the prompt text rendered above the filter textbox. Defaults to "Filter:".
Parameters:
widget(SelectionPromptWidget<<T>>):text(String):
Returns: SelectionPromptWidget<<T>>
public static SelectionPromptWidget<T> Prompt<T>(this SelectionPromptWidget<T> widget, string text)SelectionPrompt<TParent, T>(WidgetContext<TParent>, IReadOnlyList<T>)
Creates a Spectre-style filtered selection prompt over items.
Parameters:
context(WidgetContext<<TParent>>):items(IReadOnlyList<<T>>):
Returns: SelectionPromptWidget<<T>>
public static SelectionPromptWidget<T> SelectionPrompt<TParent, T>(this WidgetContext<TParent> context, IReadOnlyList<T> items) where TParent : Hex1bWidget