MenuItem
Constructors
Description
Creates a new menuitem object.
Members
Description
Gets or sets whether this menu item is "activated" or "highlighted" or "checked". This is expressed differently depending on the native OS, on most operating systems it shows a checkbox next to the menu item, on some operating systems it affects the background color and highlight. By default this is false.
Description
Gets or sets a custom control you'd like to place in the menu item. This is useful if you need to render more than just an icon or text in the menu item. It provides a way for users to enhance menu functionality. Any Control can be added and will have its width and height constrained to the system defined area, the layout will also be dictated by the operating system.
Description
Gets or sets whether the menu item is enabled or greyed out (disabled) Note that the item is still visible but does not respond to clicks and is visually denoted as inactive to the user. This is useful when you want to express that the choice or selection in the menu item is not available at the moment.
Description
Gets or sets the image that will be used for the menu item. This is placed as an icon next to menu items label. This can be any URL, including the app:// schema for referencing packaged resources, or it can be a named system icon resource.
Description
Gets or sets what key (in combination with modifiers), when pressed, activates this menu. This is useful when you want to provide a keyboard shortcut to a menu item so the user doesn't need to navigate or use their mouse (for instance, copy, or cmd/cntl+c would have 'c' for a key). Each menu item must have a unique key and modifier combination (if one in set). This is optional.
Description
Gets or sets what modifiers (in combination with key), when pressed, activates this menu. This is useful when you want to provide a keyboard shortcut to a menu item so the user doesn't need to navigate or use their mouse (for instance, copy, or cmd/cntl+c would have 'c' for a key and 'cmd' for a modifier). Each menu item must have a unique key and modifier combination (if one in set). This is optional.
Description
Gets or sets the submenu associated with this menu item. If the menu item has sub items or a sub-menu of its own it can be set here. This by default is not set and null.
Description
Gets or sets the text label used for this menu item.
Description
Gets or sets the tooltip that is shown to the user if they hover over the menu item for more than a few seconds. This can be thought of as a description of what the menu item does. It shows as a fading in off-mouse window that lets the user know more about what the menu item does.
Description
Gets or sets whether the menu item is shown or hidden. The default is true.
Methods
Description
Adds an event listener for various control level events. The first parameter is the name of the event, the second parameter is the function to call when the event happens (e.g., a callback).
Parameters
Name | Type | Description |
---|---|---|
eventName | string | The name of the event to start listening to. |
callback | function | The function that will be called when it occurs. |
Description
Removes an event listener for various application level events. The first parameter is the name of the event, the second parameter is the function that was originally given as the callback for addEventListener.
Parameters
Name | Type | Description |
---|---|---|
eventName | string | The name of the event to stop listening to. |
callback | function | The function that would have been called. |
Events
Description
Fires when the user clicks on the menu item or activates it with the keyboard shortcuts/arrows.