Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

IColorSchemeStorage Interface

In This Article

If implemented, enables you to create a custom color scheme storage in WinForms and WPF applications.

Namespace: DevExpress.XtraReports.Wizards.ColorSchemes

Assembly: DevExpress.XtraReports.v24.2.dll

NuGet Package: DevExpress.Reporting.Core

#Declaration

public interface IColorSchemeStorage

#Remarks

This code sample demonstrates how to create a custom color scheme storage and add new color schemes to it.

using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Linq;
using DevExpress.XtraReports.Wizards;
using DevExpress.XtraReports.Wizards.ColorSchemes;
//...
class CustomColorSchemeStorage : IColorSchemeStorage {

    readonly List<ColorScheme> colorSchemes = new List<ColorScheme>();

    public CustomColorSchemeStorage() {
        //Add custom color schemes to the storage.
        AddColorScheme(new ColorScheme("Independence", System.Drawing.Color.FromArgb(80, 75, 102)));
        AddColorScheme(new ColorScheme("Cerulean",
            System.Drawing.Color.FromArgb(0, 109, 167),
            System.Drawing.Color.FromArgb(0, 48, 65),
            System.Drawing.Color.FromArgb(0, 151, 167),
            System.Drawing.Color.FromArgb(205, 232, 242),
            System.Drawing.Color.FromArgb(255, 243, 245, 248),
            System.Drawing.Color.FromArgb(255, 109, 117, 129),
            System.Drawing.Color.FromArgb(255, 182, 186, 192)));
    }

    public bool AddColorScheme(ColorScheme colorScheme) {
        if(colorSchemes.Where(x => x.Name == colorScheme.Name).Any())
            return false;
        colorSchemes.Add(colorScheme);
        return true;
    }

    public bool RemoveColorScheme(string colorSchemeName) {
        ColorScheme colorScheme = colorSchemes.Where(x => x.Name == colorSchemeName).First();
        if(colorScheme != null) {
            colorSchemes.Remove(colorScheme);
            return true;
        }
        return false;
    }

    IEnumerable<ColorScheme> IColorSchemeStorage.GetColorSchemes() {
        return colorSchemes;
    }
}
//...

Implement the IWizardCustomizationService interface to register the created custom color scheme storage. Use one of the following code samples depending on the target platform:

Apply the wizard customization logic to the End-User Report Designer.

  • WinForms

    using System.Windows.Forms;
    using DevExpress.XtraReports.Wizards;
    //...
    public partial class Form1 : Form {
        public Form1() {
            //...
            reportDesigner1.AddService(typeof(IWizardCustomizationService), new WizardCustomizationService());
        }
    }
    //...
    
  • WPF

    using DevExpress.Xpf.Reports.UserDesigner.ReportWizard;
    //...
    
    public partial class MainWindow : Window
    {
    //...
        private void Window_Loaded(object sender, RoutedEventArgs e) {
            reportDesigner.ServicesRegistry.Add(new TypeEntry() { ServiceType = typeof(IWizardCustomizationService), ConcreteType = typeof(WizardCustomization) });
        }
    }
    //...
    

    Alternatively, you can use the following XAML code.

    <Window ...
            xmlns:dxrud="http://schemas.devexpress.com/winfx/2008/xaml/reports/userdesigner"
            xmlns:dxda="http://schemas.devexpress.com/winfx/2008/xaml/dataaccess">
    
        <dxrud:ReportDesigner>
            <dxrud:ReportDesigner.ServicesRegistry>
                <dxda:TypeEntry ServiceType="{x:Type dxrudw:IWizardCustomizationService}" 
                                ConcreteType="{x:Type local:WizardCustomization}" />
            </dxrud:ReportDesigner.ServicesRegistry>
        </dxrud:ReportDesigner>
    </Window>
    
See Also