Back to Devexpress

XRTextBox Class

dashboard-devexpress-dot-dashboardcommon-d9b048df.md

latest3.9 KB
Original Source

XRTextBox Class

An XRTextBox control that displays a TextBox dashboard item in the exported document.

Namespace : DevExpress.DashboardCommon

Assembly : DevExpress.Dashboard.v25.2.Core.dll

NuGet Package : DevExpress.Dashboard.Core

Declaration

csharp
public class XRTextBox :
    XRRichText
vb
Public Class XRTextBox
    Inherits XRRichText

Remarks

XRTextBox is a printable control that corresponds to a TextBox item. Call the e.GetPrintableControls/e.GetPrintableControl method to get the XRTextBox control when you handle one of the following events:

The following code snippet illustrates how to get XRTextBox and customize the TextBox dashboard item:

csharp
using DevExpress.DashboardCommon;
using DevExpress.XtraReports.UI;
using System.Collections.Generic;
using System.Windows.Forms;
//...
private void DashboardDesigner1_CustomExport_1(object sender, CustomExportEventArgs e){
    foreach (KeyValuePair<string, XRControl> xrControl in e.GetPrintableControls()){
        XRTextBox xrTextBox = xrControl.Value as XRTextBox;
        if (xrTextBox != null){
            xrTextBox.CalculateDocumentVariable += OnCalculateDocumentVariable;
        }
    }
}
private void OnCalculateDocumentVariable(object sender, DevExpress.XtraRichEdit.CalculateDocumentVariableEventArgs e){
    if(e.VariableName=="DataItem0")
        e.Value += " (Custom text for Exporter)";
}
vb
Imports DevExpress.DashboardCommon
Imports DevExpress.XtraReports.UI
Imports System.Collections.Generic
Imports System.Windows.Forms
'...
Private Sub DashboardDesigner1_CustomExport_1(ByVal sender As Object, ByVal e As CustomExportEventArgs)
    For Each xrControl As KeyValuePair(Of String, XRControl) In e.GetPrintableControls()
        Dim xrTextBox As XRTextBox = TryCast(xrControl.Value, XRTextBox)
        If xrTextBox IsNot Nothing Then
            AddHandler xrTextBox.CalculateDocumentVariable, AddressOf OnCalculateDocumentVariable
        End If
    Next xrControl
End Sub
Private Sub OnCalculateDocumentVariable(ByVal sender As Object, ByVal e As DevExpress.XtraRichEdit.CalculateDocumentVariableEventArgs)
    If e.VariableName="DataItem0" Then
        e.Value &= " (Custom text for Exporter)"
    End If
End Sub

Inheritance

Object MarshalByRefObject Component XRControl XRFieldEmbeddableControl XRRichTextBase XRRichText XRTextBox

See Also

XRTextBox Members

DevExpress.DashboardCommon Namespace