Back to Devexpress

FavoritePropertyExtension Class

xtrareports-devexpress-dot-xtrareports-dot-extensions-45194710.md

latest4.8 KB
Original Source

FavoritePropertyExtension Class

Provides the functionality required to implement a custom storage for favorite properties.

Namespace : DevExpress.XtraReports.Extensions

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
public abstract class FavoritePropertyExtension
vb
Public MustInherit Class FavoritePropertyExtension

Remarks

The End-User Report Designer’s Properties panel provides the Favorite view that allows end-users to display only their favorite or most frequently used properties.

Create a descendant from the abstract FavoritePropertyExtension class to provide a custom storage for favorite properties (such as a desired file on a hard drive, database, cloud or any other location).

Manage all storing and loading logic at the level of the SaveProperties and TryLoadProperties methods. You can also override the GetFavoriteProperties method to write your own logic to obtain control favorite properties (by default, the favorite list includes properties marked with the Favorite attribute).

To register the implemented storage, create its instance and pass it to the static RegisterExtensionGlobal method.

The FavoritePropertyDirectoryExtension class is inherited from the FavoritePropertyExtension class and is intended to manage persisting favorite properties in a file system. By default, these properties are stored in the %localappdata%\Developer Express Inc\XtraReports Suite\ComponentProperties.xml file.

The following code snippet demonstrates how to store the favorite list in the directory with the application’s executable file.

csharp
using System.Windows.Forms;
using System.IO;
using DevExpress.XtraReports.Extensions;

static class Program {
    static void Main() {
        // ...
        string path = Path.Combine(Application.StartupPath, "FavoriteProperties.xml");
        FavoritePropertyExtension.RegisterExtensionGlobal(new FavoritePropertyDirectoryExtension(path));
    }
}
vb
Imports System.Windows.Forms
Imports System.IO
Imports DevExpress.XtraReports.Extensions

Module Program
    Private Sub Main()
        ' ...
        Dim path As String = Path.Combine(Application.StartupPath, "FavoriteProperties.xml")
        FavoritePropertyExtension.RegisterExtensionGlobal(New FavoritePropertyDirectoryExtension(path))
    End Sub
End Module

See the following topics for more information:

Inheritance

Object FavoritePropertyExtension FavoritePropertyDirectoryExtension

See Also

FavoritePropertyExtension Members

FavoritePropertyDirectoryExtension

DevExpress.XtraReports.Extensions Namespace