Exemplo n.º 1
0
 /// <summary>
 /// Initialize a new instance <see cref="MainMenu"/>
 /// </summary>
 public MainMenu()
 {
     Background         = Application.SystemColors.MenuBackground;
     Foreground         = Application.SystemColors.MenuForeground;
     selectedBackground = Application.SystemColors.MenuHighlight;
     selectedForeground = Application.SystemColors.MenuHighlightText;
     disabledBackground = Application.SystemColors.MenuInactiveFace;
     disabledForeground = Application.SystemColors.MenuInactiveText;
     mnemonicForeground = Application.SystemColors.MnemonicForeground;
     Items             = new MenuItemCollection(null);
     IsOpened          = false;
     selectedLevelItem = null;
     popups            = new Stack <PopupMenuWindow>();
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initialize a new instance <see cref="MenuItem"/> with <see cref="MenuItemBase.Text"/> value and
 /// other properties
 /// </summary>
 public MenuItem(string text,
                 Shortcut?shortcut,
                 bool enabled  = true,
                 bool visible  = true,
                 bool @checked = false)
 {
     Text         = text;
     Shortcut     = shortcut;
     Enabled      = enabled;
     Visible      = visible;
     Checked      = @checked;
     mnemonic     = -1;
     ShowShortcut = true;
     Items        = new MenuItemCollection(this);
 }
Exemplo n.º 3
0
        private void CreateContent(MenuItemCollection items)
        {
            popupContent = new PopupMenuContent(items, ownerMenu)
            {
                Height = this.Height - 2,
            };
            popupContent.OnSelectedItemClick += SelectedItemClick;
            var selectedItem = items.FirstOrDefault(x => x.Visible && x.Enabled);

            if (selectedItem != null)
            {
                popupContent.SelectedIndex = items.IndexOf(selectedItem);
            }
            var border = new PopupMenuContentBox(items)
            {
                BorderThickness = new Thickness(2, 1),
            };

            border.AddContent(popupContent);
            AddContent(border);
        }
Exemplo n.º 4
0
 internal PopupMenuContentBox(MenuItemCollection items)
 {
     this.items = items;
 }