Back to Devexpress

DefaultBindablePropertyAttribute Class

xtrareports-devexpress-dot-xtrareports-9347a4f3.md

latest4.1 KB
Original Source

DefaultBindablePropertyAttribute Class

Enables you to make a custom property the default property to bind a XRControl descendant when dropping a Field List item on the control.

Namespace : DevExpress.XtraReports

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
[AttributeUsage(AttributeTargets.Class)]
public sealed class DefaultBindablePropertyAttribute :
    Attribute
vb
<AttributeUsage(AttributeTargets.Class)>
Public NotInheritable Class DefaultBindablePropertyAttribute
    Inherits Attribute

Example

This example illustrates the use of the DefaultBindablePropertyAttribute and SRCategoryAttribute that define the behavior of custom properties specified for XRControl descendants.

csharp
using DevExpress.XtraReports;
using DevExpress.XtraReports.Localization;
using DevExpress.XtraReports.UI;
// ...

// The following line specifies the default property to bind the control 
// to a field dropped from the Field List.
[DefaultBindableProperty("MyCustomProperty")]
public class MyCustomLabel : XRLabel {
    // The following line specifies the Properties window category, 
    // where a custom property is located.
    [SRCategory(ReportStringId.CatAppearance)]
    // When BindableAttribute is applied, the property will appear
    // in the Data category, as well as in the custom category (if specified).
    [System.ComponentModel.Bindable(true)]
    public string MyCustomProperty { get; set; }
}

public class MyCustomPageHeaderBand : PageHeaderBand {
    // When no custom Properties window category is specified, 
    // a property appears in the Misc category.
    public string MyCustomBandProperty { get; set; }
}
vb
Imports DevExpress.XtraReports
Imports DevExpress.XtraReports.Localization
Imports DevExpress.XtraReports.UI
' ...

' The following line specifies the default property to bind the control 
' to a field dropped from the Field List.
<DefaultBindableProperty("MyCustomProperty")> _
Public Class MyCustomLabel
    Inherits XRLabel
    ' The following line specifies the Properties window category, 
    ' where a custom property is located.
    ' When BindableAttribute is applied, the property will appear
    ' in the Data category, as well as in the custom category (if specified).
    <SRCategory(ReportStringId.CatAppearance)> _
     _
    Public Property MyCustomProperty() As String
        Get
            Return m_MyCustomProperty
        End Get
        Set
            m_MyCustomProperty = Value
        End Set
    End Property
    Private m_MyCustomProperty As String
End Class

Public Class MyCustomPageHeaderBand
    Inherits PageHeaderBand
    ' When no custom Properties window category is specified, 
    ' a property appears in the Misc category.
    Public Property MyCustomBandProperty() As String
        Get
            Return m_MyCustomBandProperty
        End Get
        Set
            m_MyCustomBandProperty = Value
        End Set
    End Property
    Private m_MyCustomBandProperty As String
End Class

Inheritance

Object Attribute DefaultBindablePropertyAttribute

See Also

DefaultBindablePropertyAttribute Members

SRCategoryAttribute

DevExpress.XtraReports Namespace