Skip to main content

RichEditControl.CustomizeMergeFields Event

Fires when the ‘Insert Merge Field’ command button is clicked, and enables you to customize a drop-down field list.

Namespace: DevExpress.XtraRichEdit

Assembly: DevExpress.XtraRichEdit.v23.2.dll

NuGet Packages: DevExpress.Win.PivotGrid, DevExpress.Win.RichEdit, DevExpress.Win.TreeMap

Declaration

public event CustomizeMergeFieldsEventHandler CustomizeMergeFields

Event Data

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

Property Description
MergeFieldsNames Gets or sets a list of fields shown by the InsertMergeField command with their display names.

Remarks

Use the CustomizeMergeFieldsEventArgs.MergeFieldsNames property to specify fields and field names to show in the drop-down list.

View Example

private void richEditControl1_CustomizeMergeFields(object sender, DevExpress.XtraRichEdit.CustomizeMergeFieldsEventArgs e)
{
  List<MergeFieldName> mergeFieldNames = new List<MergeFieldName>(e.MergeFieldsNames);

  mergeFieldNames.Remove(mergeFieldNames.Find(mfn => mfn.Name.ToLower() == "password"));
  mergeFieldNames.ForEach(ChangeDisplayName);
  mergeFieldNames.Sort(new ReverseComparer());

  e.MergeFieldsNames = mergeFieldNames.ToArray();
}

private static void ChangeDisplayName(MergeFieldName mfn)
{
  mfn.DisplayName += " (field)";
}
See Also