using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Input; namespace AIStudio.Wpf.DiagramDesigner { /// /// Provides a mechanism for constructing MenuItems /// within a ViewModel /// /// /// CreateMenus() /// { /// var menu = new List(); /// //create the File Menu /// var miFile = new CinchMenuItem("File"); /// var miExit = new CinchMenuItem("Exit"); /// miExit.Command = ExitApplicationCommand; /// miFile.Children.Add(miExit); /// menu.Add(miFile); /// //create the Actions Menu /// menu.Add(new CinchMenuItem("Actions")); /// return menu; /// } /// /// /// public List MenuOptions /// { /// get /// { /// return CreateMenus(); /// } /// } /// /// AND IN XAML DO THE FOLLOWING FOR THE STYLE /// /// /// AND YOU CAN CREATE A MENU LIKE THIS /// /// /// /// /// /// /// /// ]]> /// public class CinchMenuItem { #region Public Properties public string Text { get; set; } public string IconUrl { get; set; } public bool IsChecked { get; set; } public bool IsCheckable { get; set; } public List Children { get; private set; } public object CommandParameter { get; set; } public ICommand Command { get; set; } #endregion #region Ctor public CinchMenuItem() { Children = new List(); } public CinchMenuItem(string item) { Text = item; Children = new List(); } #endregion } }