Class MenuItem
An item contained inside a Menu element.
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: solution.dll
Syntax
public class MenuItem : BaseVisualElement, IEventHandler, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IResolvedStyle, IContextOverrideElement, INotifyValueChanged<bool>, IPressable
Constructors
MenuItem()
Default constructor.
Declaration
public MenuItem()
Fields
activeUssClassname
The MenuItem active styling class.
Declaration
public static readonly string activeUssClassname
Field Value
Type | Description |
---|---|
string |
checkmarkUssClassName
The MenuItem checkmark styling class.
Declaration
public static readonly string checkmarkUssClassName
Field Value
Type | Description |
---|---|
string |
iconUssClassName
The MenuItem icon styling class.
Declaration
public static readonly string iconUssClassName
Field Value
Type | Description |
---|---|
string |
labelUssClassName
The MenuItem label styling class.
Declaration
public static readonly string labelUssClassName
Field Value
Type | Description |
---|---|
string |
selectableUssClassname
The MenuItem selectable mode styling class.
Declaration
public static readonly string selectableUssClassname
Field Value
Type | Description |
---|---|
string |
shortcutUssClassName
The MenuItem shortcut styling class.
Declaration
public static readonly string shortcutUssClassName
Field Value
Type | Description |
---|---|
string |
subMenuIconUssClassname
The MenuItem submenu icon styling class.
Declaration
public static readonly string subMenuIconUssClassname
Field Value
Type | Description |
---|---|
string |
subMenuItemUssClassname
The MenuItem submenu mode styling class.
Declaration
public static readonly string subMenuItemUssClassname
Field Value
Type | Description |
---|---|
string |
ussClassName
The MenuItem main styling class.
Declaration
public static readonly string ussClassName
Field Value
Type | Description |
---|---|
string |
Properties
active
Enable or disable the active mode of the item.
Declaration
public bool active { get; set; }
Property Value
Type | Description |
---|---|
bool |
clickable
Clickable Manipulator for this MenuItem.
Declaration
public Pressable clickable { get; set; }
Property Value
Type | Description |
---|---|
Pressable |
contentContainer
The content container of the MenuItem.
Declaration
public override VisualElement contentContainer { get; }
Property Value
Type | Description |
---|---|
VisualElement |
Overrides
hasSubMenu
Declaration
public bool hasSubMenu { get; }
Property Value
Type | Description |
---|---|
bool |
icon
The icon to display next to the label.
Declaration
public string icon { get; set; }
Property Value
Type | Description |
---|---|
string |
label
The label text value.
Declaration
public string label { get; set; }
Property Value
Type | Description |
---|---|
string |
selectable
Enable or disable the selectable mode of the item.
A selectable item is an item with a small checkmark as leading UI element.
Declaration
public bool selectable { get; set; }
Property Value
Type | Description |
---|---|
bool |
shortcut
The shortcut text value.
Declaration
public string shortcut { get; set; }
Property Value
Type | Description |
---|---|
string |
subMenu
Sub Menu linked to this item.
An item with a submenu mode enabled has a small caret as trailing UI element which defines that a sub menu will appear if you trigger the item's action.
Declaration
public Menu subMenu { get; set; }
Property Value
Type | Description |
---|---|
Menu |
value
The selected state of the item.
Declaration
public bool value { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
SetValueWithoutNotify(bool)
Set the selected state of this item.
See value and selectable properties for more info.
Declaration
public void SetValueWithoutNotify(bool newValue)
Parameters
Type | Name | Description |
---|---|---|
bool | newValue | The new selected state. |
Events
subMenuOpened
The event raised when the item's submenu is opened.
Declaration
public event Action subMenuOpened
Event Type
Type | Description |
---|---|
Action |