KB Article T136134
Visible to All Users

How to customize Skin Gallery - Remove / rename skins and groups

Description:
How to hide unnecessary skins and skin groups from the skin gallery?

Answer:
1. REMOVE (HIDE) A SPECIFIC SKIN
Traverse through the gallery group collection, then through its gallery item collection and hide a corresponding item:

C#
private void InitRibbonSkinGallery() { SkinHelper.InitSkinGallery(skinGalleryBarItem); } string[] skinsToHide = {"Black","Blue","Seven","Sharp" }; // populate with names of unnecessary skins private void HideSkins(string[] skinsToHide) { for(var i = 0; i < skinGalleryBarItem.Gallery.Groups.Count; i++) { var group = skinGalleryBarItem.Gallery.Groups[i]; if(group == null) { continue; } for(var j = 0; j < group.Items.Count; j++) { var item = group.Items[j]; if(item == null) { continue; } foreach(var skin in skinsToHide) { if(String.Equals(item.Caption, skin)) { item.Visible = false; } } } } }
Visual Basic 6
Private Sub InitRibbonSkinGallery() SkinHelper.InitSkinGallery(skinGalleryBarItem) End Sub Private skinsToHide() As String = {"Black","Blue","Seven","Sharp" } 'populate with names of unnecessary skins Private Sub HideSkins(ByVal skinsToHide() As String) For i = 0 To skinGalleryBarItem.Gallery.Groups.Count - 1 Dim group = skinGalleryBarItem.Gallery.Groups(i) If group Is Nothing Then Continue For End If For j = 0 To group.Items.Count - 1 Dim item = group.Items(j) If item Is Nothing Then Continue For End If For Each skin In skinsToHide If String.Equals(item.Caption, skin) Then item.Visible = False End If Next skin Next j Next i End Sub

This is discussed in the How to remove certain skins from the bonus skins collection  ticket.

2. REMOVE  A SPECIFIC SKIN GROUP
Remove a required group from the collection:

C#
string skinGroup = "Standard Skins"; RemoveSkinGroups(skinGroup); void RemoveSkinGroups(string skinGroup) { skinGalleryBarItem.Gallery.Groups.Remove(skinGalleryBarItem.Gallery.Groups.OfType<GalleryItemGroup>().First(x => String.Equals(x.Caption, skinGroup))); }
Visual Basic 6
Dim skinGroup As String = "Standard Skins" RemoveSkinGroups(skinGroup, SkinRibbonGalleryBarItem1) '... Private Sub RemoveSkinGroups(skinGroup As String, item As SkinRibbonGalleryBarItem)     item.Gallery.Groups.Remove(item.Gallery.Groups.OfType(Of GalleryItemGroup)().First(Function(x) [String].Equals(x.Caption, skinGroup))) End Sub

This issue is discussed in the How to remove the "Theme Skin" skin group from the In-Ribbon gallery populated with available skins  thread.

3. REMOVE GROUPING
Fill the In-Ribbon and In-Dropdown gallery with required skins manually.
To obtain all available skins in your project, use the SkinManager.Skinsproperty. To populate the In-Dropdown gallery, handle theRibbonGalleryBarItem.GalleryInitDropDownGalleryevent:

C#
DevExpress.XtraBars.RibbonGalleryBarItem skinGalleryBarItem; SkinContainerCollection skins; void InitSkinGallery() { //SkinHelper.InitSkinGallery(skinGalleryBarItem, true); skins = SkinManager.Default.Skins; for (int i = 0; i < 14; i++) { int index = rgbiSkins.Gallery.Groups[0].Items.Add(new GalleryItem()); GalleryItem item = skinGalleryBarItem.Gallery.Groups[0].Items[index]; item.Description = skins[index].SkinName; item.Image = galleryImageCollection.Images[i]; } } private void skinGalleryBarItem_GalleryInitDropDownGallery(object sender, InplaceGalleryEventArgs e) { e.PopupGallery.AllowHoverImages = false; e.PopupGallery.ItemClick += new GalleryItemClickEventHandler(PopupGallery_ItemClick); for (int i = 0; i < e.PopupGallery.Groups[0].Items.Count; i++) { GalleryItem item = e.PopupGallery.Groups[0].Items[i]; item.Description = skins[i].SkinName; item.Caption = skins[i].SkinName; } } void PopupGallery_ItemClick(object sender, GalleryItemClickEventArgs e) { defaultBarAndDockingController1.Controller.LookAndFeel.SkinName = e.Item.Description; }
Visual Basic 6
Private skinGalleryBarItem As DevExpress.XtraBars.RibbonGalleryBarItem Private skins As SkinContainerCollection Private Sub InitSkinGallery() 'SkinHelper.InitSkinGallery(skinGalleryBarItem, true); skins = SkinManager.Default.Skins For i As Integer = 0 To 13 Dim index As Integer = rgbiSkins.Gallery.Groups(0).Items.Add(New GalleryItem()) Dim item As GalleryItem = skinGalleryBarItem.Gallery.Groups(0).Items(index) item.Description = skins(index).SkinName item.Image = galleryImageCollection.Images(i) Next i End Sub Private Sub skinGalleryBarItem_GalleryInitDropDownGallery(ByVal sender As Object, ByVal e As InplaceGalleryEventArgs) e.PopupGallery.AllowHoverImages = False AddHandler e.PopupGallery.ItemClick, AddressOf PopupGallery_ItemClick For i As Integer = 0 To e.PopupGallery.Groups(0).Items.Count - 1 Dim item As GalleryItem = e.PopupGallery.Groups(0).Items(i) item.Description = skins(i).SkinName item.Caption = skins(i).SkinName Next i End Sub Private Sub PopupGallery_ItemClick(ByVal sender As Object, ByVal e As GalleryItemClickEventArgs) defaultBarAndDockingController1.Controller.LookAndFeel.SkinName = e.Item.Description End Sub

See Skin Gallery - How to remove skin grouping  ticket to learn more.

4. CHANGE A SKIN NAME
Traverse through the gallery group collection, then through its gallery item collection, obtain a required GalleryItem  and change the GalleryItem.Caption  property for this purpose.
See How to change/remove the DevExpress Style caption from the Skin Menu/Drop-down gallery  for more information.

5. CHANGE A SKIN ICON
Traverse through the gallery group  collection, then through its gallery item  collection, obtain a required GalleryItem  and set the Image and HoverImage  properties.
See Skin Gallery - How to change a skin icon (image) and name (caption)  for more information.

Show previous comments (4)
C C
Consafe Logistics AB 7 years ago

    How do I set some groups as "not selected" before first time the "skinDropDownButtonItem1" is shown?
    (see attachment)

    DevExpress Support Team 7 years ago

      Hello Martin,

      I have created a separate ticket on your behalf (T664633: How to hide certain groups displayed in SkinDropDownButtonItem). I will address it shortly.

      M M
      Mohammad M.Pirooz 6 years ago

        Great

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.