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.v24.1.dll
NuGet Packages: DevExpress.Win.PivotGrid, DevExpress.Win.RichEdit, DevExpress.Win.TreeMap
Declaration
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.
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