CommandPalette is a searchable command launcher built on top of the unified Command system.
CommandPalette uses the popup/window system and is available only in fullscreen Terminal.Run(...) applications.
CommandPalette lists commands discovered from the current focus context:
TerminalAppOnly commands marked with CommandPresentation.CommandPalette are shown.
Create a palette instance and register a command that opens it:
using XenoAtom.Terminal;
using XenoAtom.Terminal.UI.Commands;
using XenoAtom.Terminal.UI.Controls;
using XenoAtom.Terminal.UI.Input;
var palette = new CommandPalette();
root.AddCommand(new Command
{
Id = "App.CommandPalette",
LabelMarkup = "Command palette",
Gesture = new KeyGesture(TerminalChar.CtrlP, TerminalModifiers.Ctrl),
Presentation = CommandPresentation.CommandBar | CommandPresentation.CommandPalette,
Execute = _ => palette.Show(),
});
When open:
When displayed via CommandPalette.Show(), the palette can be wrapped with a template visual (border/chrome) using CommandPaletteStyle:
using XenoAtom.Terminal.UI.Controls;
using XenoAtom.Terminal.UI.Styling;
var palette = new CommandPalette();
palette.Style(CommandPaletteStyle.Default with
{
PopupTemplateFactory = visual => new Border(visual),
});
HorizontalAlignment = Align.Start, VerticalAlignment = Align.Start