/// <summary> /// Adds a menu item, by wrapping the ArrayList Add method. /// </summary> /// <param name="menuItem"></param> public void AddMenuItem(MenuItem menuItem) { MenuItemList.Add(menuItem); }
/// <summary> /// Constructs a MainMenuWindow for the specified program. /// </summary> /// <param name="program"></param> public MainMenuWindow(MySimpleWPFApplication program) : base(program) { // Create some colors for the text items. Color instructionTextColor = ColorUtility.ColorFromRGB(255, 255, 255); Color backgroundColor = ColorUtility.ColorFromRGB(0, 0, 0); Color upperBackgroundColor = ColorUtility.ColorFromRGB(69, 69, 69); Color unselectedItemColor = ColorUtility.ColorFromRGB(192, 192, 192); Color selectedItemColor = ColorUtility.ColorFromRGB(128, 128, 128); // The Main window contains a veritcal StackPanel. StackPanel panel = new StackPanel(Orientation.Vertical); this.Child = panel; // The top child contains a horizontal StackPanel. m_MenuItemPanel = new MenuItemPanel(this.Width, this.Height); // The top child contains the menu items. We pass in the small bitmap, // large bitmap a description and then a large bitmap to use as a common // sized bitmap for calculating the width and height of a MenuItem. MenuItem menuItem1 = new MenuItem( Resources.BitmapResources.Vertical_Stack_Panel_Icon_Small, Resources.BitmapResources.Vertical_Stack_Panel_Icon, "Vertical Stack Panel", Resources.BitmapResources.Canvas_Panel_Icon); MenuItem menuItem2 = new MenuItem( Resources.BitmapResources.Horizontal_Stack_Panel_Icon_Small, Resources.BitmapResources.Horizontal_Stack_Panel_Icon, "Horizontal Stack Panel", Resources.BitmapResources.Canvas_Panel_Icon); MenuItem menuItem3 = new MenuItem( Resources.BitmapResources.Canvas_Panel_Icon_Small, Resources.BitmapResources.Canvas_Panel_Icon, "Canvas Panel", Resources.BitmapResources.Canvas_Panel_Icon); MenuItem menuItem4 = new MenuItem( Resources.BitmapResources.Scrollable_Panel_Icon_Small, Resources.BitmapResources.Scrollable_Panel_Icon, "Scrollable Panel", Resources.BitmapResources.Canvas_Panel_Icon); MenuItem menuItem5 = new MenuItem( Resources.BitmapResources.Free_Drawing_Panel_Icon_Small, Resources.BitmapResources.Free_Drawing_Panel_Icon, "Free Drawing Panel", Resources.BitmapResources.Canvas_Panel_Icon); // Add each of the menu items to the menu item panel m_MenuItemPanel.AddMenuItem(menuItem1); m_MenuItemPanel.AddMenuItem(menuItem2); m_MenuItemPanel.AddMenuItem(menuItem3); m_MenuItemPanel.AddMenuItem(menuItem4); m_MenuItemPanel.AddMenuItem(menuItem5); // Add the menu item panel to the main window panel panel.Children.Add(m_MenuItemPanel); }