Class MenuBuilder
A utility class to build a Menu programmatically.
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: solution.dll
Syntax
public class MenuBuilder : AnchorPopup<MenuBuilder>
Constructors
Name | Description |
---|---|
MenuBuilder(VisualElement, ApplicationContext, VisualElement, VisualElement) | Constructor. |
Properties
Name | Description |
---|---|
closeOnSelection | Close the menu automatically when an item is selected. |
currentMenu | The last menu in the stack. |
Methods
Name | Description |
---|---|
AddAction(int, Action<MenuItem>) | Add an Action menu item to the current menu. |
AddAction(int, string, string, string, EventCallback<ClickEvent>) | Add an Action menu item to the current menu. |
AddAction(int, string, string, EventCallback<ClickEvent>) | Add an Action menu item to the current menu. |
AddDivider(Action<MenuDivider>) | Add a Menu Divider to the current menu. |
AddSection(Action<MenuSection>) | Add a Section to the current menu. |
Build(VisualElement, Menu) | Create a MenuBuilder instance. |
GetFocusableElement() | Returns the element that will be focused when the view will become visible. The default value is `null`. |
GetMovableElement() | Method which must return the visual element that needs to be moved, based on the anchor position and size. |
InvokeDismissedEventHandlers(DismissType) | Called when the popup has been dismissed. This method will invoke any handlers attached to the dismissed event. |
Pop() | Go back to the parent menu and make it the current menu. |
PushSubMenu(int, string, string) | Create an action menu item, add a sub-menu to the current menu, and make it the current menu. |
SetCloseOnSelection(bool) | Close the menu automatically when an item is selected. |
ShouldAnimate() | Implement this method to know if the popup should call AnimateViewIn() and AnimateViewOut(DismissType) methods or not. |