public static List <CommandGesturePair> GetCommandGesturePairs(MenuItemsCollection collection) { List <CommandGesturePair> result = new List <CommandGesturePair>(); result.AddRange(from mi in collection.OfType <vmMenuItem>() where mi.Command != null && mi.Gesture != null select new CommandGesturePair { MenuItem = mi, Command = mi.Command, Gesture = mi.Gesture }); foreach (vmMenuItemsContainer mic in collection.OfType <vmMenuItemsContainer>()) { result.AddRange(GetCommandGesturePairs(mic.Items)); } return(result); }
public vmMenuItemsContainer() { Items = new MenuItemsCollection(); }