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

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

public static string[] GetFavoriteProperties(
    Type componentType
)

#Parameters

Name Type Description
componentType 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:

See Also