/// <summary> /// Fill the element gallery of all types of element. /// </summary> private void CreateElementGallery() { GalleryItem item = null; GalleryItemGroup group = null; List <Element> elements = new List <Element>(); Assembly asm = Assembly.GetAssembly(typeof(Element)); rgbElements.Gallery.ShowGroupCaption = false; rgbElements.Gallery.ShowItemText = true; rgbElements.Gallery.ColumnCount = 4; rgbElements.Gallery.Groups.Clear(); foreach (ElementType eType in ElementType.FindAll()) { // If group doesn't exist, create it if (!this.ExistsGalleryGroup(eType.Group)) { group = new GalleryItemGroup(); group.Caption = eType.Group; rgbElements.Gallery.Groups.Add(group); } // Add the element inside the group item = new GalleryItem(); item.Caption = eType.Name; item.Description = eType.Description; item.Image = eType.TypeIcon; item.Tag = eType; item.ItemClick += GalleryItemClick; this.GetGalleryGroup(eType.Group).Items.Add(item); } // Select the first item rgbElements.Gallery.Groups[0].Items[0].Checked = true; }