Back to Devexpress

HtmlContentPopup.CustomDisplayText Event

windowsforms-devexpress-dot-xtraeditors-dot-htmlcontentpopup-097ab2f7.md

latest3.0 KB
Original Source

HtmlContentPopup.CustomDisplayText Event

Allows you to specify custom display text for bound field values.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Events")]
public event CustomDisplayTextEventHandler CustomDisplayText
vb
<DXCategory("Events")>
Public Event CustomDisplayText As CustomDisplayTextEventHandler

Event Data

The CustomDisplayText event's data class is CustomDisplayTextEventArgs. The following properties provide information specific to this event:

PropertyDescription
DisplayTextGets or sets an editor’s display text.
ValueGets an editor’s current value.

Remarks

The ${FieldName} syntax in HTML markup inserts values of fields/properties from the control’s data context (HtmlContentPopup.DataContext). See the following article for more information: Data Binding.

The CustomDisplayText event allows you to specify custom display text for bound field values. The event contains the following arguments:

  • PropertyName — The name of the bound field for which you need to return custom text.
  • Value — Specifies the bound field’s value.
  • DisplayText — Gets or sets custom display text of the Value. The parameter initially contains the default text presentation of the Value object.

The following example handles the CustomDisplayText event to wrap email addresses in apostrophes:

csharp
void OnCustomDisplayText(object sender, HtmlContentCustomDisplayTextEventArgs e) {
    if(e.PropertyName == "Email")
        e.DisplayText = "'" + e.DisplayText + "'";
}
vb
Private Sub OnCustomDisplayText(sender As Object, e As DevExpress.XtraEditors.HtmlContentCustomDisplayTextEventArgs) Handles HtmlContentControl1.CustomDisplayText
    If e.PropertyName = "Email" Then
        e.DisplayText = "'" & e.DisplayText & "'"
    End If
html
<div class='content'>${Email}</div>

See Also

HtmlContentPopup Class

HtmlContentPopup Members

DevExpress.XtraEditors Namespace