Exemple #1
0
        public MenuItem CreateMenuItem(CommandBarDefinitionBase contextMenuDefinition, IReadOnlyList <CommandBarGroupDefinition> groups, Func <CommandBarGroupDefinition, IReadOnlyList <CommandBarItemDefinition> > itemsFunc)
        {
            var menuItem = new MenuItem(contextMenuDefinition);

            CreateRecursive(ref menuItem, contextMenuDefinition, groups, itemsFunc);
            return(menuItem);
        }
Exemple #2
0
        public void CreateMenuBar(IMenuHostViewModel model)
        {
            var topLevelDefinitions =
                model.TopLevelDefinitions.Where(x => !model.DefinitionHost.ExcludedItemDefinitions.Contains(x));

            foreach (var topLevelDefinition in topLevelDefinitions)
            {
                var groups = model.DefinitionHost.GetSortedGroupsOfDefinition(topLevelDefinition);
                model.BuildLogical(topLevelDefinition, groups, model.DefinitionHost.GetItemsOfGroup);
                var t = GetSingleSubDefinitions(topLevelDefinition, groups, model.DefinitionHost.GetItemsOfGroup);

                foreach (var definition in t)
                {
                    var menuitem = new MenuItem(definition);
                    groups = model.DefinitionHost.GetSortedGroupsOfDefinition(definition);
                    CreateRecursive(ref menuitem, definition, groups, model.DefinitionHost.GetItemsOfGroup);
                    model.Items.Add(menuitem);
                }
            }
        }