Skin Patches
- 2 minutes to read
Skin patches allow you to embed changes directly into standard DevExpress skins. Each skin can have an unlimited number of patches applied to it.
#Create a Skin Patch
- Start the Skin Editor and switch to the “New Skin Patch” tab.
Enter the skin patch name and local storage folder where this patch should be stored, and click “Create Patch”.
Similarly to custom light skins, patches are initially empty. To modify a skin element, you should first “Activate” it.
- Edit active elements and press “Save”. You patch is now saved as a SkinName.skinpatch file.
Note
When you press “Save”, the project is saved in the Skin
#Apply and Undo Skin Patches
To load and apply a skin patch, call the SkinManager.Default.RegisterSkinPatch
method on application startup. This method has three overloads that allow you to load a .skinpatch file from local storage, stream, or assembly.
For instance, create a new folder in the Visual Studio Solution Explorer panel and use the “Add | Existing Item…” dialog to add your patch file to this folder. Set the “Copy to Output Directory” option for this file to “Copy Always”.
Now you can apply it as follows:
namespace SkinPatch {
static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
DevExpress.Skins.SkinManager.Default.RegisterSkinPatch(Application.StartupPath +
"\\patches\\Basic-FormBorderThickness.skinpatch");
Application.Run(new Form1());
}
}
}
To undo all patches applied to a DevExpress skin and revert it back to its default state, call the SkinManager.Default.ResetSkin
method.
using DevExpress.LookAndFeel;
using DevExpress.Skins;
using System;
void btnReset_Click(object sender, EventArgs e) {
SkinManager.Default.ResetSkin(SkinStyle.Basic);
}