windowsforms-devexpress-dot-xtraeditors-dot-htmlcontentcontrol-1f4528fe.md
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
[DXCategory("Events")]
public event HtmlContentCustomDisplayTextEventHandler CustomDisplayText
<DXCategory("Events")>
Public Event CustomDisplayText As HtmlContentCustomDisplayTextEventHandler
The CustomDisplayText event's data class is DevExpress.XtraEditors.HtmlContentCustomDisplayTextEventArgs.
The ${FieldName} syntax in HTML markup inserts values of fields/properties from the control’s data context (HtmlContentControl.DataContext). See 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 e-mail addresses in apostrophes:
private void htmlContentControl1_CustomDisplayText(object sender, HtmlContentCustomDisplayTextEventArgs e) {
if(e.PropertyName == "Email")
e.DisplayText = "'" + e.DisplayText + "'";
}
Private Sub HtmlContentControl1_CustomDisplayText(sender As Object, e As DevExpress.XtraEditors.HtmlContentCustomDisplayTextEventArgs) Handles HtmlContentControl1.CustomDisplayText
If e.PropertyName = "Email" Then
e.DisplayText = "'" & e.DisplayText & "'"
End If
<div class='content'>${Email}</div>
See Also