diff --git a/Terminal.Gui/Views/Menu.cs b/Terminal.Gui/Views/Menu.cs
index 2c77abcfb..bf073e4d1 100644
--- a/Terminal.Gui/Views/Menu.cs
+++ b/Terminal.Gui/Views/Menu.cs
@@ -47,15 +47,7 @@ namespace Terminal.Gui {
///
/// Initializes a new instance of
///
- public MenuItem (Key shortcut = Key.Null)
- {
- Title = "";
- Help = "";
- shortcutHelper = new ShortcutHelper ();
- if (shortcut != Key.Null) {
- shortcutHelper.Shortcut = shortcut;
- }
- }
+ public MenuItem (Key shortcut = Key.Null) : this ("", "", null, null, null, shortcut) { }
///
/// Initializes a new instance of .
@@ -216,8 +208,7 @@ namespace Terminal.Gui {
/// The parent of this if exist, otherwise is null.
public MenuBarItem (ustring title, ustring help, Action action, Func canExecute = null, MenuItem parent = null) : base (title, help, action, canExecute, parent)
{
- SetTitle (title ?? "");
- Children = null;
+ Initialize (title, null, null, true);
}
///
@@ -228,15 +219,7 @@ namespace Terminal.Gui {
/// The parent of this if exist, otherwise is null.
public MenuBarItem (ustring title, MenuItem [] children, MenuItem parent = null)
{
- if (children == null) {
- throw new ArgumentNullException (nameof (children), "The parameter cannot be null. Use an empty array instead.");
- }
- SetTitle (title ?? "");
- if (parent != null) {
- Parent = parent;
- }
- SetChildrensParent (children);
- Children = children;
+ Initialize (title, children, parent);
}
///
@@ -247,22 +230,7 @@ namespace Terminal.Gui {
/// The parent of this if exist, otherwise is null.
public MenuBarItem (ustring title, List
public event Action MenuOpening;
+ ///
+ /// Raised when a menu is opened.
+ ///
+ public event Action MenuOpened;
+
///
/// Raised when a menu is closing.
///
public event Action MenuClosing;
internal Menu openMenu;
- internal Menu openCurrentMenu;
+ Menu ocm;
+ internal Menu openCurrentMenu {
+ get => ocm;
+ set {
+ if (ocm != value) {
+ ocm = value;
+ OnMenuOpened ();
+ }
+ }
+ }
internal List