FavoritePropertyExtension.GetFavoriteProperties(Type) Method
Returns predefined favorite properties for the specified type.
Namespace: DevExpress.XtraReports.Extensions
Assembly: DevExpress.XtraReports.v24.2.dll
NuGet Package: DevExpress.Reporting.Core
#Declaration
#Parameters
Name | Type | Description |
---|---|---|
component |
Type | An object that specifies the type for which favorite properties should be obtained. |
#Returns
Type | Description |
---|---|
String[] | An array of strings that specify favorite property names. |
#Remarks
Use the static FavoritePropertyExtension.GetFavoriteProperties
method to get the predefined set of favorite properties for a specific report element type. You can then customize the obtained array as required (delete and/or add new properties) and assign it to the storage extension class using the FavoritePropertyDirectoryExtension.SaveProperties method.
The following example allows you to customize predefined favorites for a report, in particular, remove the FilterString property and add the CalculatedFields property.
using System;
using System.Windows;
using System.Collections.Generic;
using System.IO;
using DevExpress.XtraReports.Extensions;
using DevExpress.XtraReports.FavoriteProperties;
using DevExpress.XtraReports.UI;
// ...
string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "FavoriteProperties.xml");
FavoritePropertyDirectoryExtension extension = new FavoritePropertyDirectoryExtension(path);
DescriptionSet set;
if (!extension.TryLoadProperties(out set)) {
List<string> favorites = new List<string>(FavoritePropertyExtension.GetFavoriteProperties(typeof(XtraReport)));
favorites.Remove("FilterString");
favorites.Add("CalculatedFields");
set = new DescriptionSet();
set.SetProperties(typeof(XtraReport).Name, favorites.ToArray());
extension.SaveProperties(set);
}
FavoritePropertyExtension.RegisterExtensionGlobal(extension);
}
See the following topics for more information:
- WinForms: Use Favorite Properties in the End-User Report Designer
- WPF: Use Favorite Properties in the Report Designer