1. REMOVE (HIDE) A SPECIFIC SKIN
Traverse through the gallery group collection, then through its gallery item collection and hide a corresponding item:
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; } } } } }
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:
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))); }
Private skinGroup As String = "Standard Skins" RemoveSkinGroups(skinGroup) void RemoveSkinGroups(String skinGroup) skinGalleryBarItem.Gallery.Groups.Remove(skinGalleryBarItem.Gallery.Groups.OfType(Of GalleryItemGroup)().First(Function(x) String.Equals(x.Caption, skinGroup)))
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:
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; }
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.