Back to Devexpress

ExpressionBindingDescription Class

xtrareports-devexpress-dot-xtrareports-dot-expressions-8ae29297.md

latest6.6 KB
Original Source

ExpressionBindingDescription Class

Stores information about expression bindings for properties displayed in the End-User Report Designer Properties window.

Namespace : DevExpress.XtraReports.Expressions

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
public class ExpressionBindingDescription
vb
Public Class ExpressionBindingDescription

Remarks

When you implement custom controls, you can define bindable properties — the properties to which users can bind data. To show these properties in the Properties grid as properties to which expressions are enabled, call the ExpressionBindingDescriptor.SetPropertyDescription method with the newly created ExpressionBindingDescription class instance as a parameter.

The ExpressionBindingDescription class instance contains the following information:

EventNames A collection of events in which the property is available.Position The node index in the tree view displayed in the Properties window ‘s Expressions tab. This option has effect only for the Classic View of the Properties window.BindableProperties A collection of the property’s inner bindable properties.ScopeNameThe property category in the Properties window ‘s Expressions tab. This option has effect only for the Classic View of the Properties window.

Tip

You can create the ExpressionBindingDescription instance and call the ExpressionBindingDescriptor.SetPropertyDescription method to enable expressions for properties of built-in reporting controls.

Example: Enable and Disable Expressions for XRLabel’s properties

The following code sample demonstrates how to enable expressions for the XRLabel‘s Angle property and hide the XRLabel ‘s Tag property in the Properties panel.

csharp
using DevExpress.XtraReports.Expressions;
using DevExpress.XtraReports.UI;
using System.Windows.Forms;
using System;
// ...
private void Form1_Load(object sender, EventArgs e) {
    // Create a Design Tool with an assigned report instance.
    ReportDesignTool designTool = new ReportDesignTool(new XtraReport1());

    // Specify settings for a new "Angle" property.
    string[] events = new string[] { "BeforePrint" };
    int position = 0;
    string[] innerProperties = new string[0];
    string category = "New Category";

    // Create a new description.
    ExpressionBindingDescription description = new ExpressionBindingDescription(
        events, position, innerProperties, category
    );

    // Set the description for the XRLabel's "Angle" property.
    ExpressionBindingDescriptor.SetPropertyDescription(typeof(XRLabel), "Angle", description);

    // Hide the "Tag" property from the "Properties" panel.
    ExpressionBindingDescriptor.HidePropertyDescriptions(typeof(XRLabel), "Tag");

    designTool.ShowDesigner();
}
vb
Imports DevExpress.XtraReports.Expressions
Imports DevExpress.XtraReports.UI
Imports System.Windows.Forms
Imports System
' ...
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
    ' Create a Design Tool with an assigned report instance.
    Dim designTool As New ReportDesignTool(New XtraReport1())

    ' Specify settings for a new "Angle" property.
    Dim events_Renamed() As String = { "BeforePrint" }
    Dim position As Integer = 0
    Dim innerProperties(-1) As String
    Dim category As String = "New Category"

    ' Create a new description.
    Dim description As New ExpressionBindingDescription(events_Renamed, position, innerProperties, category)

    ' Set the description for the XRLabel's "Angle" property.
    ExpressionBindingDescriptor.SetPropertyDescription(GetType(XRLabel), "Angle", description)

    ' Hide the "Tag" property from the "Properties" panel.
    ExpressionBindingDescriptor.HidePropertyDescriptions(GetType(XRLabel), "Tag")

    designTool.ShowDesigner()
End Sub

Office-Inspired View of the Properties window.

Classic View of the Properties window.

Inheritance

Object ExpressionBindingDescription

See Also

ExpressionBindingDescription Members

DevExpress.XtraReports.Expressions Namespace