Back to Devexpress

FavoritePropertyDirectoryExtension.SaveProperties(DescriptionSet) Method

xtrareports-devexpress-dot-xtrareports-dot-extensions-dot-favoritepropertydirectoryextension-dot-saveproperties-x28-devexpress-dot-xtrareports-dot-favoriteproperties-dot-descriptionset-x29.md

latest5.1 KB
Original Source

FavoritePropertyDirectoryExtension.SaveProperties(DescriptionSet) Method

Saves the specified favorite list to the storage.

Namespace : DevExpress.XtraReports.Extensions

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
public override void SaveProperties(
    DescriptionSet descriptions
)
vb
Public Overrides Sub SaveProperties(
    descriptions As DescriptionSet
)

Parameters

NameTypeDescription
descriptionsDescriptionSet

An object that specifies the favorite list.

|

Remarks

By default, the End-User Report Designer’s favorite list includes element properties marked with the Favorite attribute. You can specify your own default set of favorite properties to display in the Properties panel using the SaveProperties method.

Create a DescriptionSet class instance and use its DescriptionSet.SetProperties method that accepts the report element name and an array of property names. Then, assign this instance to the storage extension class using the FavoritePropertyDirectoryExtension.SaveProperties method.

The following example illustrates how to define favorite properties for the Label control and the report itself. All other report elements will include the predefined favorite list.

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

static class Program {
    static void Main() {
        //...
        string path = Path.Combine(Application.StartupPath, "FavoriteProperties.xml");
        FavoritePropertyDirectoryExtension extension = new FavoritePropertyDirectoryExtension(path);
        DescriptionSet set;
        if (!extension.TryLoadProperties(out set)) {
            set = new DescriptionSet();
            set.SetProperties(typeof(XRLabel).Name, new string[] { "BackColor", "ForeColor" });
            set.SetProperties(typeof(XtraReport).Name, new string[] { "DataSource", "DataMember" });
            extension.SaveProperties(set);
        }
        FavoritePropertyExtension.RegisterExtensionGlobal(extension);
    }
}
vb
Imports System.Windows.Forms
Imports System.IO
Imports DevExpress.XtraReports.Extensions
Imports DevExpress.XtraReports.FavoriteProperties
Imports DevExpress.XtraReports.UI

Module Program
    Private Sub Main()
        ' ...
        Dim path As String = Path.Combine(Application.StartupPath, "FavoriteProperties.xml")
        Dim extension As FavoritePropertyDirectoryExtension = New FavoritePropertyDirectoryExtension(path)
        Dim [set] As DescriptionSet
        If Not extension.TryLoadProperties([set]) Then
            [set] = New DescriptionSet()
            [set].SetProperties(GetType(XRLabel).Name, New String() {"BackColor", "ForeColor"})
            [set].SetProperties(GetType(XtraReport).Name, New String() {"DataSource", "DataMember"})
            extension.SaveProperties([set])
        End If
        FavoritePropertyExtension.RegisterExtensionGlobal(extension)
    End Sub
End Module

See the following topics for more information:

See Also

FavoritePropertyDirectoryExtension Class

FavoritePropertyDirectoryExtension Members

DevExpress.XtraReports.Extensions Namespace