IColorSchemeStorage Interface
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
Remarks
Tip
Online Example:
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:
WinForms
using System.Collections.Generic; using System.ComponentModel.Design; using System.Linq; using DevExpress.DataAccess.UI.Wizard; using DevExpress.DataAccess.Wizard.Model; using DevExpress.XtraReports.Wizards; using DevExpress.XtraReports.Wizards.ColorSchemes; //... class WizardCustomizationService : IWizardCustomizationService { // Implement other methods here. // ... // Register the custom color scheme storage. void IWizardCustomizationService.CustomizeReportWizard(IWizardCustomization<XtraReportModel> tool) { tool.RegisterType<IColorSchemeStorage, CustomColorSchemeStorage>(); } } //...
WPF
using System.Collections.Generic; using System.Linq; using DevExpress.DataAccess.Wizard.Model; using DevExpress.Xpf.DataAccess.DataSourceWizard; using DevExpress.Xpf.Reports.UserDesigner.ReportWizard; using DevExpress.XtraReports.UI; using DevExpress.XtraReports.Wizards; using DevExpress.XtraReports.Wizards.ColorSchemes; //... public class WizardCustomization : IWizardCustomizationService { // Implement other methods here. // ... // Register the custom color scheme storage. void IWizardCustomizationService.CustomizeReportWizard(ReportWizardCustomizationModel customization, ViewModelSourceIntegrityContainer container) { container.RegisterType<IColorSchemeStorage, CustomColorSchemeStorage>(); } } //...
Apply the wizard customization logic to the End-User Report Designer.
WinForms
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