-
-
Notifications
You must be signed in to change notification settings - Fork 5
ScrollMenu
Iuga Alexandru edited this page Sep 3, 2018
·
1 revision
A menu in which the user can navigate by using the up/down arrow keys.
- Up/Down key navigation - Select a menu item using up/down keys.
- Shortcut key selection - Select a menu item using a shortcut key.
- Enable/Disable menu items - The disabled items are displayed with another color and cannot be selected.
- Show/Hide menu items - The hidden items are not displayed at all.
- Commands - Can attach Commands to menu items that will be executed when the menu item is selected.
- Menu horizontal alignment - Align the menu in the console's buffer (Left, Center, Right).
- Items horizontal alignment - Horizontally align the menu items inside the menu (Left, Center, Right).
- Circular navigation - When reaching the top item go to the bottom item. When reaching the bottom item go to the top item.
- IRepeatableSupport - This control offers support to be used by the ControlRepeater.
- Initially selected item - By setting the SelectedIndex or SelectedItem properties before displaying the menu.
Please see the demo project.
private void DisplayMenu()
{
ScrollMenu scrollMenu = new ScrollMenu
{
MarginTop = 1,
MarginBottom = 1,
EraseAfterClose = true
};
scrollMenu.AddItems(new IMenuItem[]
{
new LabelMenuItem
{
Text = "New Game",
Command = new NewGameCommand()
},
new YesNoMenuItem
{
Text = "Save Game",
Command = new SaveGameCommand()
},
new LabelMenuItem
{
Text = "Load Game",
Command = new LoadGameCommand()
},
...
});
scrollMenu.Display();
}
Result: