Пример #1
0
 protected virtual void OnCreateCustomGroupControl(CreateCustomGroupControlEventArgs args)
 {
     if (CreateCustomGroupControl != null)
     {
         CreateCustomGroupControl(this, args);
     }
 }
Пример #2
0
        private void FillMenuContents(DevExpress.Web.MenuItemCollection holderMenuItems, ChoiceActionItemCollection actionItems)
        {
            foreach (ChoiceActionItem groupValue in actionItems)
            {
                if (!groupValue.Active)
                {
                    continue;
                }

                if (groupValue.Items.Count == 0)
                {
                    ASPxMenuItemChoiceActionItem itemWrapper = new ASPxMenuItemChoiceActionItem(SingleChoiceAction,
                                                                                                groupValue);
                    MenuItemToWrapperMap.Add(itemWrapper.CurrentMenuItem, itemWrapper);
                    holderMenuItems.Add(itemWrapper.CurrentMenuItem);
                    ActionItemToMenuItemMap.Add(groupValue, itemWrapper.CurrentMenuItem);
                }
                else
                {
                    ASPxMenuGroupChoiceActionItem groupItem = new ASPxMenuGroupChoiceActionItem(SingleChoiceAction,
                                                                                                groupValue);
                    GroupWrappers.Add(groupItem);
                    DevExpress.Web.MenuItem group = groupItem.MenuGroup;
                    ActionItemToMenuGroupMap.Add(groupValue, group);
                    holderMenuItems.Add(group);
                    ItemsDisplayStyle itemsDisplayStyle = ItemsDisplayStyle.LargeIcons;
                    if (groupValue.Model != null)
                    {
                        itemsDisplayStyle = ItemsDisplayStyle.List;
                        if (groupValue.Model is IModelChoiceActionItemChildItemsDisplayStyle)
                        {
                            itemsDisplayStyle =
                                ((IModelChoiceActionItemChildItemsDisplayStyle)groupValue.Model).ChildItemsDisplayStyle;
                        }
                    }
                    CreateCustomGroupControlEventArgs args = new CreateCustomGroupControlEventArgs(groupValue);
                    OnCreateCustomGroupControl(args);
                    if (args.Control != null)
                    {
                        var customControlItem = new ASPxMenuCustomControlItem(args.Control);
                        customControlItem.InitTemplate();
                        group.Items.Add(customControlItem);
                    }
                    else
                    {
                        switch (itemsDisplayStyle)
                        {
                        case ItemsDisplayStyle.LargeIcons:
                        case ItemsDisplayStyle.List:
                            if (groupValue.IsHierarchical())
                            {
                                FillMenuContents(group.Items, groupValue.Items);
                            }
                            else
                            {
                                FillMenuGroup(group, groupValue);
                            }
                            break;
                        }
                    }
                }
            }
        }