FavoritePropertyExtension.GetFavoriteProperties(Type) Method

Returns predefined favorite properties for the specified type.

Namespace: DevExpress.XtraReports.Extensions

Assembly: DevExpress.XtraReports.v18.1.dll

Declaration

public static string[] GetFavoriteProperties(
    Type componentType
)
Public Shared Function GetFavoriteProperties(
    componentType As Type
) As String()

Parameters

Type Name Description
Type componentType

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.

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: