Ejemplo n.º 1
0
        protected ListItemDescriptor CreateWidgetMenu(String menuTitle = "Widgets", ImageSource glyph = null)
        {
            if (null == glyph)
            {
                glyph = DevExpressHelper.GetGlyph("GlobalColorScheme_16x16.png");
            }

            var menu = new ListItemDescriptor(menuTitle, glyph);

            foreach (var item in AvailableWidgets)
            {
                var root = menu;

                foreach (var category in item.Category.Path.Split(';'))
                {
                    var match = root.Items.FirstOrDefault(menuItem => menuItem.Caption == category);

                    if (null == match)
                    {
                        var categoryMenu = new ListItemDescriptor(category, item.Glyph);
                        root.Items.Add(categoryMenu);
                        root = categoryMenu;
                    }
                    else
                    {
                        root = match as ListItemDescriptor;
                    }
                }

                root.Items.Add((new WidgetButtonItemDescriptor(item.Name, item, item.Glyph)
                {
                    Command = CreateNewWidget
                }));
            }

            return(menu);
        }
Ejemplo n.º 2
0
 public WidgetAttribute(String name, String glyph = null)
 {
     Name  = name;
     Glyph = DevExpressHelper.GetGlyph(glyph);
 }